baseapp-backend 0.0.51__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- baseapp/README.md +40 -0
- baseapp/__init__.py +6 -0
- baseapp/activity_log/README.md +104 -0
- baseapp/activity_log/__init__.py +0 -0
- baseapp/activity_log/admin.py +0 -0
- baseapp/activity_log/apps.py +9 -0
- baseapp/activity_log/context.py +15 -0
- baseapp/activity_log/graphql/__init__.py +0 -0
- baseapp/activity_log/graphql/filters.py +40 -0
- baseapp/activity_log/graphql/interfaces.py +50 -0
- baseapp/activity_log/graphql/object_types.py +133 -0
- baseapp/activity_log/graphql/queries.py +17 -0
- baseapp/activity_log/graphql/subscriptions.py +49 -0
- baseapp/activity_log/middleware.py +92 -0
- baseapp/activity_log/migrations/0001_initial.py +25 -0
- baseapp/activity_log/migrations/0002_auto_20241216_1804.py +29 -0
- baseapp/activity_log/migrations/0003_delete_activitylog_activitylog.py +38 -0
- baseapp/activity_log/migrations/__init__.py +0 -0
- baseapp/activity_log/models.py +35 -0
- baseapp/activity_log/permissions.py +34 -0
- baseapp/activity_log/tests/__init__.py +0 -0
- baseapp/activity_log/tests/conftest.py +2 -0
- baseapp/activity_log/tests/factories.py +1 -0
- baseapp/activity_log/tests/test_graphql_mutations.py +90 -0
- baseapp/activity_log/tests/test_graphql_queries.py +415 -0
- baseapp/content_feed/__init__.py +0 -0
- baseapp/content_feed/admin.py +17 -0
- baseapp/content_feed/apps.py +9 -0
- baseapp/content_feed/graphql/__init__.py +0 -0
- baseapp/content_feed/graphql/filters.py +21 -0
- baseapp/content_feed/graphql/mutations.py +80 -0
- baseapp/content_feed/graphql/object_types.py +54 -0
- baseapp/content_feed/graphql/queries.py +14 -0
- baseapp/content_feed/migrations/0001_initial.py +69 -0
- baseapp/content_feed/migrations/0002_contentpostimage.py +52 -0
- baseapp/content_feed/migrations/0003_alter_contentpostimage_image.py +25 -0
- baseapp/content_feed/migrations/0004_alter_contentpostimage_post.py +25 -0
- baseapp/content_feed/migrations/0005_contentpost_is_reactions_enabled_and_more.py +27 -0
- baseapp/content_feed/migrations/__init__.py +0 -0
- baseapp/content_feed/models.py +69 -0
- baseapp/content_feed/tests/__init__.py +0 -0
- baseapp/content_feed/tests/conftest.py +2 -0
- baseapp/content_feed/tests/factories.py +19 -0
- baseapp/content_feed/tests/test_graphql_mutations_create.py +99 -0
- baseapp_api_key/README.md +297 -0
- baseapp_api_key/__init__.py +0 -0
- baseapp_api_key/admin.py +50 -0
- baseapp_api_key/apps.py +9 -0
- baseapp_api_key/graphql/__init__.py +1 -0
- baseapp_api_key/graphql/consumers.py +71 -0
- baseapp_api_key/graphql/middleware.py +17 -0
- baseapp_api_key/management/commands/api_key.py +69 -0
- baseapp_api_key/managers.py +124 -0
- baseapp_api_key/migrations/0001_initial.py +64 -0
- baseapp_api_key/migrations/__init__.py +0 -0
- baseapp_api_key/models.py +30 -0
- baseapp_api_key/querysets.py +17 -0
- baseapp_api_key/rest_framework/__init__.py +0 -0
- baseapp_api_key/rest_framework/authentication.py +51 -0
- baseapp_api_key/rest_framework/permissions.py +33 -0
- baseapp_api_key/settings.py +1 -0
- baseapp_api_key/tests/__init__.py +0 -0
- baseapp_api_key/tests/conftest.py +11 -0
- baseapp_api_key/tests/factories.py +24 -0
- baseapp_api_key/tests/fixtures.py +0 -0
- baseapp_api_key/tests/helpers.py +14 -0
- baseapp_api_key/tests/integration/__init__.py +0 -0
- baseapp_api_key/tests/mixins.py +1 -0
- baseapp_api_key/tests/unit/__init__.py +0 -0
- baseapp_api_key/tests/unit/test_api_key.py +195 -0
- baseapp_auth/README.md +142 -0
- baseapp_auth/__init__.py +0 -0
- baseapp_auth/admin.py +144 -0
- baseapp_auth/anonymization.py +42 -0
- baseapp_auth/apps.py +23 -0
- baseapp_auth/emails.py +298 -0
- baseapp_auth/exceptions.py +12 -0
- baseapp_auth/fields.py +14 -0
- baseapp_auth/forms.py +73 -0
- baseapp_auth/graphql/__init__.py +1 -0
- baseapp_auth/graphql/filters.py +21 -0
- baseapp_auth/graphql/object_types.py +160 -0
- baseapp_auth/graphql/permissions.py +17 -0
- baseapp_auth/graphql/queries.py +32 -0
- baseapp_auth/locale/es/LC_MESSAGES/django.mo +0 -0
- baseapp_auth/locale/es/LC_MESSAGES/django.po +384 -0
- baseapp_auth/managers.py +32 -0
- baseapp_auth/migrations/0001_initial.py +15 -0
- baseapp_auth/migrations/0002_passwordvalidation.py +60 -0
- baseapp_auth/migrations/0003_superuserupdatelog.py +66 -0
- baseapp_auth/migrations/0004_alter_superuserupdatelog_assigner.py +25 -0
- baseapp_auth/migrations/__init__.py +0 -0
- baseapp_auth/models.py +200 -0
- baseapp_auth/password_validators.py +62 -0
- baseapp_auth/permissions.py +37 -0
- baseapp_auth/pipeline.py +74 -0
- baseapp_auth/querysets.py +41 -0
- baseapp_auth/rest_framework/__init__.py +0 -0
- baseapp_auth/rest_framework/change_email/__init__.py +0 -0
- baseapp_auth/rest_framework/change_email/serializers.py +57 -0
- baseapp_auth/rest_framework/change_email/views.py +102 -0
- baseapp_auth/rest_framework/change_expired_password/__init__.py +0 -0
- baseapp_auth/rest_framework/change_expired_password/serializers.py +57 -0
- baseapp_auth/rest_framework/change_expired_password/views.py +20 -0
- baseapp_auth/rest_framework/confirm_email/__init__.py +0 -0
- baseapp_auth/rest_framework/confirm_email/serializers.py +21 -0
- baseapp_auth/rest_framework/confirm_email/views.py +40 -0
- baseapp_auth/rest_framework/forgot_password/__init__.py +0 -0
- baseapp_auth/rest_framework/forgot_password/serializers.py +63 -0
- baseapp_auth/rest_framework/forgot_password/views.py +63 -0
- baseapp_auth/rest_framework/jwt/__init__.py +0 -0
- baseapp_auth/rest_framework/jwt/serializers.py +52 -0
- baseapp_auth/rest_framework/jwt/tokens.py +26 -0
- baseapp_auth/rest_framework/jwt/views.py +29 -0
- baseapp_auth/rest_framework/login/__init__.py +0 -0
- baseapp_auth/rest_framework/login/helpers.py +37 -0
- baseapp_auth/rest_framework/login/serializers.py +42 -0
- baseapp_auth/rest_framework/login/views.py +41 -0
- baseapp_auth/rest_framework/mfa/__init__.py +0 -0
- baseapp_auth/rest_framework/mfa/mixins.py +26 -0
- baseapp_auth/rest_framework/pre_auth/__init__.py +0 -0
- baseapp_auth/rest_framework/pre_auth/serializers.py +49 -0
- baseapp_auth/rest_framework/pre_auth/views.py +33 -0
- baseapp_auth/rest_framework/register/__init__.py +0 -0
- baseapp_auth/rest_framework/register/serializers.py +49 -0
- baseapp_auth/rest_framework/register/views.py +26 -0
- baseapp_auth/rest_framework/routers/__init__.py +0 -0
- baseapp_auth/rest_framework/routers/account.py +50 -0
- baseapp_auth/rest_framework/urls/__init__.py +0 -0
- baseapp_auth/rest_framework/urls/auth_authtoken.py +16 -0
- baseapp_auth/rest_framework/urls/auth_jwt.py +16 -0
- baseapp_auth/rest_framework/urls/auth_mfa.py +20 -0
- baseapp_auth/rest_framework/urls/auth_mfa_jwt.py +18 -0
- baseapp_auth/rest_framework/urls/mfa.py +55 -0
- baseapp_auth/rest_framework/urls/pre_auth.py +16 -0
- baseapp_auth/rest_framework/users/__init__.py +0 -0
- baseapp_auth/rest_framework/users/channels.py +17 -0
- baseapp_auth/rest_framework/users/fields.py +8 -0
- baseapp_auth/rest_framework/users/mixins.py +58 -0
- baseapp_auth/rest_framework/users/parsers.py +14 -0
- baseapp_auth/rest_framework/users/permissions.py +6 -0
- baseapp_auth/rest_framework/users/serializers.py +215 -0
- baseapp_auth/rest_framework/users/tasks.py +42 -0
- baseapp_auth/rest_framework/users/views.py +180 -0
- baseapp_auth/settings.py +18 -0
- baseapp_auth/static/baseapp_auth/css/grouped_permission_widget.css +37 -0
- baseapp_auth/static/baseapp_auth/js/grouped_permission_widget.js +142 -0
- baseapp_auth/tasks.py +18 -0
- baseapp_auth/templates/admin/widgets/grouped_permission_widget.html +88 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-superuser-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-superuser-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/anonymize-user-error-superuser-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-superuser-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-superuser-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/anonymize-user-success-superuser-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/change-email-confirm-body.html.j2 +8 -0
- baseapp_auth/templates/users/emails/change-email-confirm-body.txt.j2 +11 -0
- baseapp_auth/templates/users/emails/change-email-confirm-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/change-email-verify-body.html.j2 +8 -0
- baseapp_auth/templates/users/emails/change-email-verify-body.txt.j2 +11 -0
- baseapp_auth/templates/users/emails/change-email-verify-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/new-superuser-notification-email-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/new-superuser-notification-email-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/new-superuser-notification-email-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/password-expired-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/password-expired-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/password-expired-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/password-reset-body.html.j2 +8 -0
- baseapp_auth/templates/users/emails/password-reset-body.txt.j2 +11 -0
- baseapp_auth/templates/users/emails/password-reset-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/remove-superuser-notification-email-body.html.j2 +7 -0
- baseapp_auth/templates/users/emails/remove-superuser-notification-email-body.txt.j2 +9 -0
- baseapp_auth/templates/users/emails/remove-superuser-notification-email-subject.txt.j2 +1 -0
- baseapp_auth/templates/users/emails/welcome-body.html.j2 +11 -0
- baseapp_auth/templates/users/emails/welcome-body.txt.j2 +13 -0
- baseapp_auth/templates/users/emails/welcome-subject.txt.j2 +1 -0
- baseapp_auth/tests/__init__.py +0 -0
- baseapp_auth/tests/conftest.py +12 -0
- baseapp_auth/tests/factories.py +19 -0
- baseapp_auth/tests/fixtures.py +16 -0
- baseapp_auth/tests/fixtures_mfa.py +34 -0
- baseapp_auth/tests/graphql/__init__.py +0 -0
- baseapp_auth/tests/graphql/conftest.py +2 -0
- baseapp_auth/tests/graphql/test_queries_me.py +27 -0
- baseapp_auth/tests/graphql/test_queries_user.py +171 -0
- baseapp_auth/tests/helpers.py +19 -0
- baseapp_auth/tests/integration/__init__.py +0 -0
- baseapp_auth/tests/integration/test_change_email.py +283 -0
- baseapp_auth/tests/integration/test_change_expired_password.py +136 -0
- baseapp_auth/tests/integration/test_confirm_email.py +96 -0
- baseapp_auth/tests/integration/test_forgot_password.py +152 -0
- baseapp_auth/tests/integration/test_login.py +232 -0
- baseapp_auth/tests/integration/test_pagination.py +41 -0
- baseapp_auth/tests/integration/test_pre_auth.py +75 -0
- baseapp_auth/tests/integration/test_register.py +88 -0
- baseapp_auth/tests/integration/test_users.py +515 -0
- baseapp_auth/tests/integration/test_users_channels.py +30 -0
- baseapp_auth/tests/mixins.py +1 -0
- baseapp_auth/tests/unit/__init__.py +0 -0
- baseapp_auth/tests/unit/test_celery_beat_health_check.py +32 -0
- baseapp_auth/tests/unit/test_emails.py +18 -0
- baseapp_auth/tests/unit/test_fields.py +43 -0
- baseapp_auth/tests/unit/test_forms.py +15 -0
- baseapp_auth/tests/unit/test_users.py +74 -0
- baseapp_auth/tests/unit/test_utils.py +16 -0
- baseapp_auth/tests/unit/test_widgets.py +105 -0
- baseapp_auth/tokens.py +105 -0
- baseapp_auth/utils/__init__.py +0 -0
- baseapp_auth/utils/app_and_model_verbose_names.py +17 -0
- baseapp_auth/utils/normalize_permission.py +22 -0
- baseapp_auth/utils/referral_utils.py +13 -0
- baseapp_auth/widgets.py +81 -0
- baseapp_backend-0.0.51.dist-info/METADATA +305 -0
- baseapp_backend-0.0.51.dist-info/RECORD +915 -0
- baseapp_backend-0.0.51.dist-info/WHEEL +5 -0
- baseapp_backend-0.0.51.dist-info/top_level.txt +25 -0
- baseapp_blocks/README.md +88 -0
- baseapp_blocks/__init__.py +0 -0
- baseapp_blocks/admin.py +11 -0
- baseapp_blocks/apps.py +9 -0
- baseapp_blocks/base.py +67 -0
- baseapp_blocks/graphql/__init__.py +0 -0
- baseapp_blocks/graphql/mutations.py +79 -0
- baseapp_blocks/graphql/object_types.py +74 -0
- baseapp_blocks/graphql/queries.py +2 -0
- baseapp_blocks/migrations/0001_initial.py +76 -0
- baseapp_blocks/migrations/0002_block_user.py +26 -0
- baseapp_blocks/migrations/0003_block_actor_block_target_alter_block_user.py +52 -0
- baseapp_blocks/migrations/0003_migrate_profiles.py +55 -0
- baseapp_blocks/migrations/0004_alter_block_unique_together_and_more.py +40 -0
- baseapp_blocks/migrations/__init__.py +0 -0
- baseapp_blocks/models.py +28 -0
- baseapp_blocks/permissions.py +54 -0
- baseapp_blocks/tests/__init__.py +0 -0
- baseapp_blocks/tests/conftest.py +2 -0
- baseapp_blocks/tests/factories.py +28 -0
- baseapp_blocks/tests/test_block_count.py +32 -0
- baseapp_blocks/tests/test_graphql_mutations.py +196 -0
- baseapp_chats/README.md +81 -0
- baseapp_chats/__init__.py +0 -0
- baseapp_chats/admin.py +42 -0
- baseapp_chats/apps.py +9 -0
- baseapp_chats/base.py +258 -0
- baseapp_chats/graphql/__init__.py +0 -0
- baseapp_chats/graphql/filters.py +93 -0
- baseapp_chats/graphql/interfaces.py +57 -0
- baseapp_chats/graphql/mutations.py +912 -0
- baseapp_chats/graphql/object_types.py +347 -0
- baseapp_chats/graphql/queries.py +9 -0
- baseapp_chats/graphql/subscriptions.py +151 -0
- baseapp_chats/migrations/0001_initial.py +291 -0
- baseapp_chats/migrations/0002_message_set_last_message_and_more.py +111 -0
- baseapp_chats/migrations/0003_alter_unreadmessagecount_room.py +25 -0
- baseapp_chats/migrations/0004_chatroomparticipant_has_archived_room.py +18 -0
- baseapp_chats/migrations/0005_remove_messagestatus_increment_unread_count_and_more.py +39 -0
- baseapp_chats/migrations/0006_remove_messagestatus_increment_unread_count_and_more.py +23 -0
- baseapp_chats/migrations/0007_messagestatus_increment_unread_count.py +30 -0
- baseapp_chats/migrations/0008_alter_chatroomparticipant_options.py +17 -0
- baseapp_chats/migrations/0009_remove_message_create_message_status_and_more.py +66 -0
- baseapp_chats/migrations/0010_message_deleted.py +18 -0
- baseapp_chats/migrations/0011_alter_chatroom_created_by_and_more.py +70 -0
- baseapp_chats/migrations/0012_chatroom_created_by_profile.py +27 -0
- baseapp_chats/migrations/0013_chatroom_insert_document_id_and_more.py +155 -0
- baseapp_chats/migrations/__init__.py +0 -0
- baseapp_chats/models.py +58 -0
- baseapp_chats/permissions.py +139 -0
- baseapp_chats/tests/__init__.py +0 -0
- baseapp_chats/tests/conftest.py +2 -0
- baseapp_chats/tests/factories.py +45 -0
- baseapp_chats/tests/test_graphql_mutations.py +1671 -0
- baseapp_chats/tests/test_graphql_queries.py +1289 -0
- baseapp_chats/tests/test_graphql_subscriptions.py +280 -0
- baseapp_chats/tests/test_triggers.py +28 -0
- baseapp_chats/tests/test_users.py +28 -0
- baseapp_chats/tests/test_utils.py +171 -0
- baseapp_chats/triggers.py +104 -0
- baseapp_chats/utils.py +76 -0
- baseapp_cloudflare_stream_field/README.md +129 -0
- baseapp_cloudflare_stream_field/__init__.py +2 -0
- baseapp_cloudflare_stream_field/apps.py +9 -0
- baseapp_cloudflare_stream_field/field.py +98 -0
- baseapp_cloudflare_stream_field/forms.py +14 -0
- baseapp_cloudflare_stream_field/rest_framework.py +10 -0
- baseapp_cloudflare_stream_field/static/baseapp_cloudflare_stream_field/js/baseapp_cloudflare_stream_field.js +57 -0
- baseapp_cloudflare_stream_field/static/baseapp_cloudflare_stream_field/js/tus.js +5202 -0
- baseapp_cloudflare_stream_field/static/baseapp_cloudflare_stream_field/js/tus.js.map +59 -0
- baseapp_cloudflare_stream_field/static/baseapp_cloudflare_stream_field/js/tus.min.js +2 -0
- baseapp_cloudflare_stream_field/static/baseapp_cloudflare_stream_field/js/tus.min.js.map +1 -0
- baseapp_cloudflare_stream_field/stream.py +93 -0
- baseapp_cloudflare_stream_field/tasks.py +136 -0
- baseapp_cloudflare_stream_field/templates/baseapp_cloudflare_stream_field/admin_async_file_input.html +29 -0
- baseapp_cloudflare_stream_field/tests/__init__.py +0 -0
- baseapp_cloudflare_stream_field/tests/conftest.py +3 -0
- baseapp_cloudflare_stream_field/tests/fixtures.py +300 -0
- baseapp_cloudflare_stream_field/tests/settings.py +1 -0
- baseapp_cloudflare_stream_field/tests/test_clip_video.py +39 -0
- baseapp_cloudflare_stream_field/tests/test_delete_original_trimmed_video.py +44 -0
- baseapp_cloudflare_stream_field/tests/test_generate_download_url.py +55 -0
- baseapp_cloudflare_stream_field/tests/test_refresh_from_cloudfare.py +179 -0
- baseapp_cloudflare_stream_field/tests/test_stream_client.py +57 -0
- baseapp_cloudflare_stream_field/urls.py +5 -0
- baseapp_cloudflare_stream_field/views.py +46 -0
- baseapp_cloudflare_stream_field/widgets.py +56 -0
- baseapp_comments/README.md +194 -0
- baseapp_comments/__init__.py +0 -0
- baseapp_comments/admin.py +27 -0
- baseapp_comments/apps.py +12 -0
- baseapp_comments/graphql/__init__.py +1 -0
- baseapp_comments/graphql/filters.py +30 -0
- baseapp_comments/graphql/mutations.py +232 -0
- baseapp_comments/graphql/object_types.py +186 -0
- baseapp_comments/graphql/queries.py +18 -0
- baseapp_comments/graphql/subscriptions.py +134 -0
- baseapp_comments/migrations/0001_initial.py +383 -0
- baseapp_comments/migrations/0002_alter_comment_user.py +28 -0
- baseapp_comments/migrations/0003_alter_comment_comments_count.py +24 -0
- baseapp_comments/migrations/0004_remove_comment_snapshot_insert_and_more.py +89 -0
- baseapp_comments/migrations/0005_remove_comment_snapshot_insert_and_more.py +82 -0
- baseapp_comments/migrations/0006_remove_comment_snapshot_insert_and_more.py +86 -0
- baseapp_comments/migrations/0007_remove_comment_insert_insert_and_more.py +26 -0
- baseapp_comments/migrations/0008_comment_new_profile_commentevent_new_profile_and_more.py +85 -0
- baseapp_comments/migrations/0009_migrate_profiles.py +77 -0
- baseapp_comments/migrations/0010_drop_profile_content_type.py +86 -0
- baseapp_comments/migrations/0011_rename_new_profile_to_profile.py +80 -0
- baseapp_comments/migrations/0012_alter_comment_options.py +27 -0
- baseapp_comments/migrations/0013_alter_commentevent_id.py +18 -0
- baseapp_comments/migrations/0014_alter_commentevent_pgh_context_and_more.py +39 -0
- baseapp_comments/migrations/0015_alter_commentevent_pgh_context_and_more.py +37 -0
- baseapp_comments/migrations/0016_remove_commentevent_in_reply_to_and_more.py +53 -0
- baseapp_comments/migrations/0017_alter_comment_profile.py +28 -0
- baseapp_comments/migrations/0018_comment_insert_document_id_and_more.py +43 -0
- baseapp_comments/migrations/__init__.py +0 -0
- baseapp_comments/models.py +172 -0
- baseapp_comments/notifications.py +52 -0
- baseapp_comments/permissions.py +46 -0
- baseapp_comments/signals.py +100 -0
- baseapp_comments/tests/__init__.py +0 -0
- baseapp_comments/tests/conftest.py +2 -0
- baseapp_comments/tests/factories.py +48 -0
- baseapp_comments/tests/test_comments_count.py +27 -0
- baseapp_comments/tests/test_graphql_mutations_create.py +135 -0
- baseapp_comments/tests/test_graphql_mutations_delete.py +133 -0
- baseapp_comments/tests/test_graphql_mutations_pin.py +131 -0
- baseapp_comments/tests/test_graphql_mutations_update.py +120 -0
- baseapp_comments/tests/test_graphql_queries_all_comments.py +76 -0
- baseapp_comments/tests/test_graphql_queries_comments_from_blocked_profiles.py +102 -0
- baseapp_comments/tests/test_graphql_queries_object_comments.py +408 -0
- baseapp_comments/tests/test_graphql_subscriptions.py +222 -0
- baseapp_comments/tests/test_notifications.py +43 -0
- baseapp_comments/tests/test_users.py +22 -0
- baseapp_comments/tests/test_validators.py +38 -0
- baseapp_comments/validators.py +19 -0
- baseapp_core/README.md +68 -0
- baseapp_core/__init__.py +0 -0
- baseapp_core/admin.py +25 -0
- baseapp_core/apps.py +9 -0
- baseapp_core/asgi.py +16 -0
- baseapp_core/backfill.py +304 -0
- baseapp_core/channels.py +107 -0
- baseapp_core/constants.py +1 -0
- baseapp_core/debug_toolbar.py +2 -0
- baseapp_core/deep_links.py +45 -0
- baseapp_core/deprecation.py +2 -0
- baseapp_core/exceptions.py +2 -0
- baseapp_core/graphql/README.md +432 -0
- baseapp_core/graphql/__init__.py +27 -0
- baseapp_core/graphql/connections.py +15 -0
- baseapp_core/graphql/consumers.py +130 -0
- baseapp_core/graphql/decorators.py +89 -0
- baseapp_core/graphql/errors.py +9 -0
- baseapp_core/graphql/fields.py +57 -0
- baseapp_core/graphql/middlewares.py +59 -0
- baseapp_core/graphql/models.py +20 -0
- baseapp_core/graphql/mutations.py +42 -0
- baseapp_core/graphql/object_types.py +74 -0
- baseapp_core/graphql/optimizer.py +265 -0
- baseapp_core/graphql/relay.py +68 -0
- baseapp_core/graphql/serializer_mutation.py +181 -0
- baseapp_core/graphql/testing/__init__.py +1 -0
- baseapp_core/graphql/testing/fixtures.py +229 -0
- baseapp_core/graphql/testing/test_graphql_object_type_pre_optimization.py +102 -0
- baseapp_core/graphql/testing/test_graphql_optimizer.py +426 -0
- baseapp_core/graphql/translation.py +7 -0
- baseapp_core/graphql/utils.py +190 -0
- baseapp_core/graphql/views.py +62 -0
- baseapp_core/hashids/README.md +90 -0
- baseapp_core/hashids/__init__.py +0 -0
- baseapp_core/hashids/models.py +8 -0
- baseapp_core/hashids/strategies/__init__.py +159 -0
- baseapp_core/hashids/strategies/bundle.py +27 -0
- baseapp_core/hashids/strategies/interfaces/__init__.py +15 -0
- baseapp_core/hashids/strategies/interfaces/drf_resolver.py +9 -0
- baseapp_core/hashids/strategies/interfaces/graphql_resolver.py +22 -0
- baseapp_core/hashids/strategies/interfaces/id_resolver.py +6 -0
- baseapp_core/hashids/strategies/interfaces/queryset_annotator.py +12 -0
- baseapp_core/hashids/strategies/legacy/__init__.py +17 -0
- baseapp_core/hashids/strategies/legacy/drf_resolver.py +9 -0
- baseapp_core/hashids/strategies/legacy/graphql_resolver.py +47 -0
- baseapp_core/hashids/strategies/legacy/id_resolver.py +11 -0
- baseapp_core/hashids/strategies/legacy/queryset_annotator.py +14 -0
- baseapp_core/hashids/strategies/pk/__init__.py +9 -0
- baseapp_core/hashids/strategies/pk/drf_resolver.py +14 -0
- baseapp_core/hashids/strategies/pk/graphql_resolver.py +46 -0
- baseapp_core/hashids/strategies/public_id/__init__.py +19 -0
- baseapp_core/hashids/strategies/public_id/drf_resolver.py +9 -0
- baseapp_core/hashids/strategies/public_id/graphql_resolver.py +60 -0
- baseapp_core/hashids/strategies/public_id/id_resolver.py +19 -0
- baseapp_core/hashids/strategies/public_id/queryset_annotator.py +25 -0
- baseapp_core/hashids/tests/__init__.py +0 -0
- baseapp_core/hashids/tests/test_hashids_strategy_pickers.py +410 -0
- baseapp_core/hashids/tests/test_strategy_legacy.py +146 -0
- baseapp_core/hashids/tests/test_strategy_pk.py +107 -0
- baseapp_core/hashids/tests/test_strategy_public_id.py +143 -0
- baseapp_core/hashids/utils.py +18 -0
- baseapp_core/locale/es/LC_MESSAGES/django.mo +0 -0
- baseapp_core/locale/es/LC_MESSAGES/django.po +45 -0
- baseapp_core/logging.py +37 -0
- baseapp_core/management/commands/__init__.py +0 -0
- baseapp_core/management/commands/backfill_document_ids.py +90 -0
- baseapp_core/management/commands/generate_uml.py +165 -0
- baseapp_core/management/commands/routes_info.py +55 -0
- baseapp_core/middleware.py +125 -0
- baseapp_core/migrations/0001_initial.py +73 -0
- baseapp_core/migrations/__init__.py +0 -0
- baseapp_core/models.py +256 -0
- baseapp_core/rest_framework/__init__.py +0 -0
- baseapp_core/rest_framework/decorators.py +33 -0
- baseapp_core/rest_framework/fields.py +59 -0
- baseapp_core/rest_framework/mixins.py +60 -0
- baseapp_core/rest_framework/pagination.py +5 -0
- baseapp_core/rest_framework/routers.py +44 -0
- baseapp_core/rest_framework/serializers.py +42 -0
- baseapp_core/sentry.py +46 -0
- baseapp_core/settings/__init__.py +0 -0
- baseapp_core/settings/env.py +30 -0
- baseapp_core/static/admin/horizontal_production.png +0 -0
- baseapp_core/static/admin/horizontal_staging.png +0 -0
- baseapp_core/static/emails/background_bottom.png +0 -0
- baseapp_core/static/emails/background_top.png +0 -0
- baseapp_core/static/emails/logo.png +0 -0
- baseapp_core/static/social/flat-facebook.png +0 -0
- baseapp_core/static/social/flat-instagram.png +0 -0
- baseapp_core/static/social/flat-linkedin.png +0 -0
- baseapp_core/static/social/flat-x.png +0 -0
- baseapp_core/static/social/flat-youtube.png +0 -0
- baseapp_core/swappable.py +15 -0
- baseapp_core/templates/admin/base_site.html +16 -0
- baseapp_core/templates/emails/base.html.j2 +11 -0
- baseapp_core/templates/emails/base.txt.j2 +3 -0
- baseapp_core/tests/__init__.py +0 -0
- baseapp_core/tests/conftest.py +3 -0
- baseapp_core/tests/factories.py +19 -0
- baseapp_core/tests/fixtures.py +120 -0
- baseapp_core/tests/helpers.py +45 -0
- baseapp_core/tests/mixins.py +23 -0
- baseapp_core/tests/settings.py +234 -0
- baseapp_core/tests/test_backfill.py +298 -0
- baseapp_core/tests/test_case_insensitive_fields.py +24 -0
- baseapp_core/tests/test_celery_beat_health_check.py +41 -0
- baseapp_core/tests/test_document_id_mixin.py +93 -0
- baseapp_core/tests/test_document_id_model.py +69 -0
- baseapp_core/tests/test_graphql_schema_is_loaded_when_relay_id_is_evoked.py +39 -0
- baseapp_core/tests/test_ids_resolver.py +41 -0
- baseapp_core/tests/test_jwt_auth_middleware.py +176 -0
- baseapp_core/tests/test_middleware.py +83 -0
- baseapp_core/tests/test_migration_health_check.py +63 -0
- baseapp_core/tests/test_random_name_generators.py +56 -0
- baseapp_core/tests/test_settings.py +15 -0
- baseapp_core/tests/test_token_generator.py +72 -0
- baseapp_core/tokens.py +37 -0
- baseapp_core/utils.py +29 -0
- baseapp_core/uvicorn_workers.py +7 -0
- baseapp_core/wsgi.py +16 -0
- baseapp_drf_view_action_permissions/README.md +226 -0
- baseapp_drf_view_action_permissions/__init__.py +0 -0
- baseapp_drf_view_action_permissions/action.py +148 -0
- baseapp_drf_view_action_permissions/admin.py +21 -0
- baseapp_drf_view_action_permissions/apps.py +9 -0
- baseapp_drf_view_action_permissions/middleware.py +18 -0
- baseapp_drf_view_action_permissions/migrations/0001_initial.py +46 -0
- baseapp_drf_view_action_permissions/migrations/0002_iprestriction.py +45 -0
- baseapp_drf_view_action_permissions/migrations/__init__.py +0 -0
- baseapp_drf_view_action_permissions/mixin.py +43 -0
- baseapp_drf_view_action_permissions/models.py +65 -0
- baseapp_drf_view_action_permissions/settings.py +9 -0
- baseapp_drf_view_action_permissions/tests/__init__.py +0 -0
- baseapp_drf_view_action_permissions/tests/apps.py +7 -0
- baseapp_drf_view_action_permissions/tests/conftest.py +1 -0
- baseapp_drf_view_action_permissions/tests/factories.py +74 -0
- baseapp_drf_view_action_permissions/tests/migrations/0001_initial.py +136 -0
- baseapp_drf_view_action_permissions/tests/migrations/0002_testmodel.py +34 -0
- baseapp_drf_view_action_permissions/tests/migrations/__init__.py +0 -0
- baseapp_drf_view_action_permissions/tests/models.py +22 -0
- baseapp_drf_view_action_permissions/tests/settings.py +13 -0
- baseapp_drf_view_action_permissions/tests/test_integration.py +383 -0
- baseapp_drf_view_action_permissions/tests/test_unit.py +92 -0
- baseapp_drf_view_action_permissions/utils.py +67 -0
- baseapp_e2e/README.md +102 -0
- baseapp_e2e/__init__.py +0 -0
- baseapp_e2e/apps.py +9 -0
- baseapp_e2e/conf.py +36 -0
- baseapp_e2e/e2e_scripts/__init__.py +0 -0
- baseapp_e2e/e2e_scripts/demo.py +3 -0
- baseapp_e2e/rest_framework/__init__.py +0 -0
- baseapp_e2e/rest_framework/permissions.py +7 -0
- baseapp_e2e/rest_framework/serializers.py +28 -0
- baseapp_e2e/rest_framework/views.py +58 -0
- baseapp_e2e/tests/__init__.py +0 -0
- baseapp_e2e/tests/conftest.py +11 -0
- baseapp_e2e/tests/factories.py +8 -0
- baseapp_e2e/tests/fixtures.py +0 -0
- baseapp_e2e/tests/helpers.py +1 -0
- baseapp_e2e/tests/mixins.py +1 -0
- baseapp_e2e/tests/test_e2e_endpoints.py +97 -0
- baseapp_e2e/utils.py +8 -0
- baseapp_follows/README.md +85 -0
- baseapp_follows/__init__.py +0 -0
- baseapp_follows/admin.py +11 -0
- baseapp_follows/apps.py +9 -0
- baseapp_follows/graphql/__init__.py +0 -0
- baseapp_follows/graphql/interfaces.py +58 -0
- baseapp_follows/graphql/mutations.py +90 -0
- baseapp_follows/graphql/object_types.py +47 -0
- baseapp_follows/graphql/queries.py +9 -0
- baseapp_follows/migrations/0001_initial.py +77 -0
- baseapp_follows/migrations/0002_follow_new_actor_follow_new_target.py +52 -0
- baseapp_follows/migrations/0003_migrate_profiles.py +59 -0
- baseapp_follows/migrations/0004_alter_follow_unique_together_and_more.py +33 -0
- baseapp_follows/migrations/0005_rename_new_actor_follow_actor_and_more.py +23 -0
- baseapp_follows/migrations/0006_alter_follow_actor_alter_follow_target.py +35 -0
- baseapp_follows/migrations/0007_alter_follow_unique_together.py +19 -0
- baseapp_follows/migrations/0008_create_followstats_remap_fks.py +108 -0
- baseapp_follows/migrations/__init__.py +0 -0
- baseapp_follows/models.py +149 -0
- baseapp_follows/permissions.py +27 -0
- baseapp_follows/tests/__init__.py +0 -0
- baseapp_follows/tests/conftest.py +2 -0
- baseapp_follows/tests/factories.py +24 -0
- baseapp_follows/tests/test_follow_count.py +80 -0
- baseapp_follows/tests/test_graphql_mutations.py +162 -0
- baseapp_message_templates/README.md +404 -0
- baseapp_message_templates/__init__.py +0 -0
- baseapp_message_templates/admin.py +91 -0
- baseapp_message_templates/apps.py +9 -0
- baseapp_message_templates/custom_templates.py +100 -0
- baseapp_message_templates/email_utils.py +34 -0
- baseapp_message_templates/filters.py +40 -0
- baseapp_message_templates/migrations/0001_initial.py +135 -0
- baseapp_message_templates/migrations/0002_auto_20240108_1503.py +56 -0
- baseapp_message_templates/migrations/0003_alter_emailtemplate_name_alter_smstemplate_name.py +31 -0
- baseapp_message_templates/migrations/0004_alter_emailtemplate_html_content_and_more.py +29 -0
- baseapp_message_templates/migrations/__init__.py +0 -0
- baseapp_message_templates/models.py +123 -0
- baseapp_message_templates/sendgrid.py +60 -0
- baseapp_message_templates/sms_utils.py +14 -0
- baseapp_message_templates/static/baseapp_message_templates/prose/image_dialog.js +230 -0
- baseapp_message_templates/templates/admin/baseapp_message_templates/emailtemplate/change_form.html +6 -0
- baseapp_message_templates/tests/__init__.py +0 -0
- baseapp_message_templates/tests/conftest.py +1 -0
- baseapp_message_templates/tests/factories.py +13 -0
- baseapp_message_templates/tests/unit/__init__.py +0 -0
- baseapp_message_templates/tests/unit/test_templates.py +103 -0
- baseapp_message_templates/utils.py +37 -0
- baseapp_notifications/README.md +331 -0
- baseapp_notifications/__init__.py +3 -0
- baseapp_notifications/admin.py +12 -0
- baseapp_notifications/apps.py +9 -0
- baseapp_notifications/base.py +56 -0
- baseapp_notifications/graphql/__init__.py +0 -0
- baseapp_notifications/graphql/filters.py +16 -0
- baseapp_notifications/graphql/mutations.py +125 -0
- baseapp_notifications/graphql/object_types.py +122 -0
- baseapp_notifications/graphql/queries.py +0 -0
- baseapp_notifications/graphql/subscriptions.py +62 -0
- baseapp_notifications/locale/es/LC_MESSAGES/django.mo +0 -0
- baseapp_notifications/locale/es/LC_MESSAGES/django.po +39 -0
- baseapp_notifications/migrations/0001_initial.py +134 -0
- baseapp_notifications/migrations/0002_notificationsetting.py +64 -0
- baseapp_notifications/migrations/0003_rename_notification_recipient_unread_baseapp_not_recipie_8567c3_idx.py +18 -0
- baseapp_notifications/migrations/0004_notification_insert_document_id_and_more.py +74 -0
- baseapp_notifications/migrations/__init__.py +0 -0
- baseapp_notifications/models.py +26 -0
- baseapp_notifications/tasks.py +44 -0
- baseapp_notifications/templates/emails/notification-body.html.j2 +24 -0
- baseapp_notifications/templates/emails/notification-body.txt.j2 +7 -0
- baseapp_notifications/templates/emails/notification-subject.txt.j2 +1 -0
- baseapp_notifications/tests/__init__.py +0 -0
- baseapp_notifications/tests/conftest.py +2 -0
- baseapp_notifications/tests/factories.py +27 -0
- baseapp_notifications/tests/test_graphql_mutations.py +298 -0
- baseapp_notifications/tests/test_graphql_queries.py +85 -0
- baseapp_notifications/tests/test_graphql_subscriptions.py +160 -0
- baseapp_notifications/tests/test_utils.py +138 -0
- baseapp_notifications/utils.py +145 -0
- baseapp_organizations/README.md +1 -0
- baseapp_organizations/__init__.py +0 -0
- baseapp_organizations/admin.py +11 -0
- baseapp_organizations/apps.py +9 -0
- baseapp_organizations/graphql/__init__.py +0 -0
- baseapp_organizations/graphql/mutations.py +102 -0
- baseapp_organizations/graphql/object_types.py +34 -0
- baseapp_organizations/graphql/queries.py +9 -0
- baseapp_organizations/migrations/0001_initial.py +60 -0
- baseapp_organizations/migrations/0002_organization_name.py +18 -0
- baseapp_organizations/migrations/0003_alter_organization_profile.py +28 -0
- baseapp_organizations/migrations/__init__.py +0 -0
- baseapp_organizations/models.py +41 -0
- baseapp_organizations/permissions.py +11 -0
- baseapp_organizations/tests/__init__.py +0 -0
- baseapp_organizations/tests/conftest.py +2 -0
- baseapp_organizations/tests/factories.py +9 -0
- baseapp_organizations/tests/test_graphql_mutations_create.py +56 -0
- baseapp_pages/README.md +128 -0
- baseapp_pages/__init__.py +0 -0
- baseapp_pages/admin.py +51 -0
- baseapp_pages/apps.py +8 -0
- baseapp_pages/graphql/__init__.py +8 -0
- baseapp_pages/graphql/mutations.py +122 -0
- baseapp_pages/graphql/object_types.py +164 -0
- baseapp_pages/graphql/queries.py +41 -0
- baseapp_pages/meta.py +4 -0
- baseapp_pages/migrations/0001_initial.py +298 -0
- baseapp_pages/migrations/0002_page_pageevent_page_snapshot_insert_and_more.py +227 -0
- baseapp_pages/migrations/0003_remove_page_snapshot_insert_and_more.py +97 -0
- baseapp_pages/migrations/0004_alter_page_comments_count_and_more.py +33 -0
- baseapp_pages/migrations/0005_remove_metadata_snapshot_insert_and_more.py +155 -0
- baseapp_pages/migrations/0006_alter_metadataevent_pgh_context_and_more.py +62 -0
- baseapp_pages/migrations/0007_alter_metadataevent_pgh_context_and_more.py +58 -0
- baseapp_pages/migrations/0008_remove_pageevent_pgh_context_and_more.py +41 -0
- baseapp_pages/migrations/0009_metadata_insert_document_id_and_more.py +71 -0
- baseapp_pages/migrations/__init__.py +0 -0
- baseapp_pages/models.py +158 -0
- baseapp_pages/permissions.py +28 -0
- baseapp_pages/tests/__init__.py +0 -0
- baseapp_pages/tests/conftest.py +2 -0
- baseapp_pages/tests/factories.py +18 -0
- baseapp_pages/tests/test_create_mutation.py +106 -0
- baseapp_pages/tests/test_delete_mutation.py +95 -0
- baseapp_pages/tests/test_edit_mutation.py +123 -0
- baseapp_pages/tests/test_get_queries.py +318 -0
- baseapp_pages/tests/test_list_queries.py +68 -0
- baseapp_pages/tests/utils.py +2 -0
- baseapp_payments/README.md +148 -0
- baseapp_payments/__init__.py +0 -0
- baseapp_payments/admin.py +23 -0
- baseapp_payments/apps.py +6 -0
- baseapp_payments/migrations/0001_initial.py +32 -0
- baseapp_payments/migrations/0002_create_template_emails.py +44 -0
- baseapp_payments/migrations/0003_delete_plan.py +16 -0
- baseapp_payments/migrations/0004_initial.py +57 -0
- baseapp_payments/migrations/0005_customer_created_customer_modified_and_more.py +43 -0
- baseapp_payments/migrations/__init__.py +0 -0
- baseapp_payments/models.py +47 -0
- baseapp_payments/router.py +21 -0
- baseapp_payments/serializers.py +299 -0
- baseapp_payments/tests/__init__.py +0 -0
- baseapp_payments/tests/conftest.py +1 -0
- baseapp_payments/tests/factories.py +20 -0
- baseapp_payments/tests/test_customer_viewset.py +61 -0
- baseapp_payments/tests/test_payment_method_viewset.py +100 -0
- baseapp_payments/tests/test_stripe_utils.py +53 -0
- baseapp_payments/utils.py +448 -0
- baseapp_payments/views.py +243 -0
- baseapp_pdf/README.md +93 -0
- baseapp_pdf/__init__.py +0 -0
- baseapp_pdf/apps.py +9 -0
- baseapp_pdf/exceptions.py +11 -0
- baseapp_pdf/management/commands/render_example_template_to_pdf.py +116 -0
- baseapp_pdf/management/commands/render_to_pdf.py +48 -0
- baseapp_pdf/settings.py +1 -0
- baseapp_pdf/templates/pdfs/render-template-to-pdf-example.html +221 -0
- baseapp_pdf/tests/__init__.py +0 -0
- baseapp_pdf/tests/conftest.py +1 -0
- baseapp_pdf/tests/integration/__init__.py +0 -0
- baseapp_pdf/tests/integration/test_utils.py +105 -0
- baseapp_pdf/utils.py +153 -0
- baseapp_profiles/MIGRATION.md +62 -0
- baseapp_profiles/README.md +46 -0
- baseapp_profiles/__init__.py +0 -0
- baseapp_profiles/admin.py +28 -0
- baseapp_profiles/apps.py +9 -0
- baseapp_profiles/graphql/__init__.py +3 -0
- baseapp_profiles/graphql/filters.py +64 -0
- baseapp_profiles/graphql/middleware.py +39 -0
- baseapp_profiles/graphql/mutations.py +297 -0
- baseapp_profiles/graphql/object_types.py +158 -0
- baseapp_profiles/graphql/queries.py +11 -0
- baseapp_profiles/managers.py +11 -0
- baseapp_profiles/middleware.py +26 -0
- baseapp_profiles/migrations/0001_initial.py +127 -0
- baseapp_profiles/migrations/0002_profile_blockers_count_profile_blocking_count_and_more.py +55 -0
- baseapp_profiles/migrations/0003_profile_banner_image.py +25 -0
- baseapp_profiles/migrations/0004_profile_biography.py +18 -0
- baseapp_profiles/migrations/0005_profileuserrole_status.py +20 -0
- baseapp_profiles/migrations/0006_alter_profile_name.py +20 -0
- baseapp_profiles/migrations/0007_remove_profile_followers_count_and_more.py +21 -0
- baseapp_profiles/migrations/__init__.py +0 -0
- baseapp_profiles/models.py +258 -0
- baseapp_profiles/permissions.py +66 -0
- baseapp_profiles/signals.py +10 -0
- baseapp_profiles/tests/__init__.py +0 -0
- baseapp_profiles/tests/conftest.py +2 -0
- baseapp_profiles/tests/factories.py +20 -0
- baseapp_profiles/tests/test_get_queries.py +376 -0
- baseapp_profiles/tests/test_graphql_mutations_delete.py +91 -0
- baseapp_profiles/tests/test_graphql_mutations_update.py +379 -0
- baseapp_profiles/tests/test_middleware.py +50 -0
- baseapp_profiles/tests/test_url_path.py +36 -0
- baseapp_profiles/tests/utils.py +2 -0
- baseapp_ratings/README.md +149 -0
- baseapp_ratings/__init__.py +0 -0
- baseapp_ratings/admin.py +18 -0
- baseapp_ratings/apps.py +8 -0
- baseapp_ratings/graphql/__init__.py +0 -0
- baseapp_ratings/graphql/mutations.py +83 -0
- baseapp_ratings/graphql/object_types.py +84 -0
- baseapp_ratings/graphql/queries.py +9 -0
- baseapp_ratings/migrations/0001_initial.py +71 -0
- baseapp_ratings/migrations/0002_alter_rate_target_object_id.py +18 -0
- baseapp_ratings/migrations/0003_rate_profile.py +28 -0
- baseapp_ratings/migrations/__init__.py +0 -0
- baseapp_ratings/models.py +108 -0
- baseapp_ratings/permissions.py +40 -0
- baseapp_ratings/tests/__init__.py +0 -0
- baseapp_ratings/tests/conftest.py +2 -0
- baseapp_ratings/tests/factories.py +50 -0
- baseapp_ratings/tests/test_graphql_mutations.py +84 -0
- baseapp_ratings/tests/test_graphql_queries.py +51 -0
- baseapp_reactions/README.md +153 -0
- baseapp_reactions/__init__.py +0 -0
- baseapp_reactions/admin.py +11 -0
- baseapp_reactions/apps.py +12 -0
- baseapp_reactions/graphql/__init__.py +0 -0
- baseapp_reactions/graphql/mutations.py +97 -0
- baseapp_reactions/graphql/object_types.py +102 -0
- baseapp_reactions/graphql/queries.py +9 -0
- baseapp_reactions/management/commands/update_votings_count.py +12 -0
- baseapp_reactions/migrations/0001_initial.py +80 -0
- baseapp_reactions/migrations/0002_alter_reaction_id.py +20 -0
- baseapp_reactions/migrations/0003_reaction_profile.py +26 -0
- baseapp_reactions/migrations/0004_alter_reaction_unique_together_and_more.py +29 -0
- baseapp_reactions/migrations/__init__.py +0 -0
- baseapp_reactions/models.py +142 -0
- baseapp_reactions/notifications.py +37 -0
- baseapp_reactions/permissions.py +32 -0
- baseapp_reactions/signals.py +22 -0
- baseapp_reactions/tests/__init__.py +0 -0
- baseapp_reactions/tests/conftest.py +2 -0
- baseapp_reactions/tests/factories.py +32 -0
- baseapp_reactions/tests/test_graphql_mutations.py +198 -0
- baseapp_reactions/tests/test_graphql_queries.py +54 -0
- baseapp_reactions/tests/test_notifications.py +28 -0
- baseapp_referrals/__init__.py +0 -0
- baseapp_referrals/admin.py +11 -0
- baseapp_referrals/apps.py +9 -0
- baseapp_referrals/migrations/0001_initial.py +49 -0
- baseapp_referrals/migrations/__init__.py +0 -0
- baseapp_referrals/models.py +24 -0
- baseapp_referrals/pipeline.py +11 -0
- baseapp_referrals/tests/__init__.py +0 -0
- baseapp_referrals/tests/conftest.py +1 -0
- baseapp_referrals/tests/unit/__init__.py +0 -0
- baseapp_referrals/tests/unit/test_referrals_utils.py +22 -0
- baseapp_referrals/utils.py +22 -0
- baseapp_reports/README.md +140 -0
- baseapp_reports/__init__.py +0 -0
- baseapp_reports/admin.py +20 -0
- baseapp_reports/apps.py +9 -0
- baseapp_reports/graphql/__init__.py +1 -0
- baseapp_reports/graphql/filters.py +21 -0
- baseapp_reports/graphql/mutations.py +64 -0
- baseapp_reports/graphql/object_types.py +97 -0
- baseapp_reports/graphql/queries.py +24 -0
- baseapp_reports/management/commands/update_reports_count.py +12 -0
- baseapp_reports/migrations/0001_initial.py +79 -0
- baseapp_reports/migrations/0002_alter_report_report_type.py +22 -0
- baseapp_reports/migrations/0003_report_baseapp_rep_target__171117_idx.py +23 -0
- baseapp_reports/migrations/0004_alter_report_report_type_reporttype.py +77 -0
- baseapp_reports/migrations/0005_create_default_report_types_and_transfer_values.py +129 -0
- baseapp_reports/migrations/0006_delete_old_rename_new_report_type.py +20 -0
- baseapp_reports/migrations/__init__.py +0 -0
- baseapp_reports/models.py +153 -0
- baseapp_reports/permissions.py +16 -0
- baseapp_reports/tests/__init__.py +0 -0
- baseapp_reports/tests/conftest.py +2 -0
- baseapp_reports/tests/factories.py +36 -0
- baseapp_reports/tests/test_graphql_mutations.py +86 -0
- baseapp_reports/tests/test_graphql_queries.py +49 -0
- baseapp_social_auth/README.md +96 -0
- baseapp_social_auth/__init__.py +0 -0
- baseapp_social_auth/cache/__init__.py +0 -0
- baseapp_social_auth/cache/admin.py +5 -0
- baseapp_social_auth/cache/migrations/0001_initial.py +51 -0
- baseapp_social_auth/cache/migrations/0002_alter_socialauthaccesstokencache_id.py +19 -0
- baseapp_social_auth/cache/migrations/0003_alter_socialauthaccesstokencache_id.py +19 -0
- baseapp_social_auth/cache/migrations/0004_alter_socialauthaccesstokencache_id.py +20 -0
- baseapp_social_auth/cache/migrations/__init__.py +0 -0
- baseapp_social_auth/cache/models.py +24 -0
- baseapp_social_auth/cache/pipeline.py +54 -0
- baseapp_social_auth/cache/tasks.py +13 -0
- baseapp_social_auth/referrals.py +22 -0
- baseapp_social_auth/serializers.py +27 -0
- baseapp_social_auth/settings.py +73 -0
- baseapp_social_auth/tests/__init__.py +0 -0
- baseapp_social_auth/tests/conftest.py +1 -0
- baseapp_social_auth/tests/intergration/__init__.py +0 -0
- baseapp_social_auth/tests/intergration/test_views.py +485 -0
- baseapp_social_auth/tests/pipeline.py +85 -0
- baseapp_social_auth/tests/unit/__init__.py +0 -0
- baseapp_social_auth/tests/unit/test_tasks.py +24 -0
- baseapp_social_auth/views.py +139 -0
- baseapp_url_shortening/README.md +58 -0
- baseapp_url_shortening/__init__.py +0 -0
- baseapp_url_shortening/admin.py +16 -0
- baseapp_url_shortening/apps.py +9 -0
- baseapp_url_shortening/migrations/0001_initial.py +45 -0
- baseapp_url_shortening/migrations/0002_alter_shorturl_full_url.py +18 -0
- baseapp_url_shortening/migrations/__init__.py +0 -0
- baseapp_url_shortening/models.py +24 -0
- baseapp_url_shortening/tests/__init__.py +0 -0
- baseapp_url_shortening/tests/conftest.py +1 -0
- baseapp_url_shortening/tests/factories.py +13 -0
- baseapp_url_shortening/tests/integration/__init__.py +0 -0
- baseapp_url_shortening/tests/integration/test_url_shortening.py +17 -0
- baseapp_url_shortening/tests/settings.py +1 -0
- baseapp_url_shortening/urls.py +17 -0
- baseapp_url_shortening/utils.py +19 -0
- baseapp_url_shortening/views.py +10 -0
- baseapp_wagtail/MANIFEST.in +3 -0
- baseapp_wagtail/README.md +208 -0
- baseapp_wagtail/__init__.py +0 -0
- baseapp_wagtail/apps.py +9 -0
- baseapp_wagtail/base/__init__.py +0 -0
- baseapp_wagtail/base/apps.py +7 -0
- baseapp_wagtail/base/blocks/__init__.py +6 -0
- baseapp_wagtail/base/blocks/basic_blocks/__init__.py +0 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_block/__init__.py +1 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_block/block.py +30 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_block/tests/test_custom_image_block.py +20 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_chooser_block/__init__.py +1 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_chooser_block/block.py +32 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_image_chooser_block/tests/test_custom_image_chooser_block.py +32 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_rich_text_block/__init__.py +1 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_rich_text_block/block.py +8 -0
- baseapp_wagtail/base/blocks/basic_blocks/custom_rich_text_block/tests/test_custom_rich_text_block.py +18 -0
- baseapp_wagtail/base/blocks/custom_blocks/__init__.py +0 -0
- baseapp_wagtail/base/blocks/custom_blocks/banner_block/__init__.py +1 -0
- baseapp_wagtail/base/blocks/custom_blocks/banner_block/block.py +49 -0
- baseapp_wagtail/base/blocks/custom_blocks/banner_block/tests/test_banner_block.py +28 -0
- baseapp_wagtail/base/models.py +75 -0
- baseapp_wagtail/base/rest_framework/__init__.py +0 -0
- baseapp_wagtail/base/rest_framework/page_preview/__init__.py +0 -0
- baseapp_wagtail/base/rest_framework/page_preview/views.py +35 -0
- baseapp_wagtail/base/rest_framework/pages/__init__.py +0 -0
- baseapp_wagtail/base/rest_framework/pages/serializers.py +83 -0
- baseapp_wagtail/base/rest_framework/pages/views.py +62 -0
- baseapp_wagtail/base/rest_framework/redirects/__init__.py +0 -0
- baseapp_wagtail/base/rest_framework/redirects/views.py +78 -0
- baseapp_wagtail/base/rest_framework/router.py +20 -0
- baseapp_wagtail/base/rest_framework/sitemap/__init__.py +0 -0
- baseapp_wagtail/base/rest_framework/sitemap/serializers.py +7 -0
- baseapp_wagtail/base/rest_framework/sitemap/views.py +34 -0
- baseapp_wagtail/base/rest_framework/tests/factories.py +11 -0
- baseapp_wagtail/base/rest_framework/tests/test_api_pages.py +107 -0
- baseapp_wagtail/base/rest_framework/tests/test_api_redirects.py +88 -0
- baseapp_wagtail/base/rest_framework/tests/test_api_sitemap.py +43 -0
- baseapp_wagtail/base/stream_fields/__init__.py +6 -0
- baseapp_wagtail/base/stream_fields/featured_image_stream_field.py +20 -0
- baseapp_wagtail/base/stream_fields/page_body_stream_field.py +42 -0
- baseapp_wagtail/base/stream_fields/standard_page_stream_block.py +8 -0
- baseapp_wagtail/base/tests/test_base_models.py +93 -0
- baseapp_wagtail/base/tests/test_base_wagtail_hooks.py +20 -0
- baseapp_wagtail/base/wagtail_hooks.py +28 -0
- baseapp_wagtail/locale/__init__.py +0 -0
- baseapp_wagtail/locale/utils.py +9 -0
- baseapp_wagtail/management/__init__.py +0 -0
- baseapp_wagtail/management/commands/__init__.py +0 -0
- baseapp_wagtail/management/commands/wagtail_revert_package_migrations.py +59 -0
- baseapp_wagtail/medias/__init__.py +0 -0
- baseapp_wagtail/medias/apps.py +7 -0
- baseapp_wagtail/medias/image_formats.py +24 -0
- baseapp_wagtail/medias/migrations/0001_initial.py +193 -0
- baseapp_wagtail/medias/migrations/0002_customimage_description_and_more.py +25 -0
- baseapp_wagtail/medias/migrations/__init__.py +0 -0
- baseapp_wagtail/medias/models.py +52 -0
- baseapp_wagtail/medias/rest_framework/__init__.py +0 -0
- baseapp_wagtail/medias/rest_framework/router.py +8 -0
- baseapp_wagtail/medias/serializers.py +39 -0
- baseapp_wagtail/medias/tests/factories.py +24 -0
- baseapp_wagtail/medias/tests/test_medias_models.py +35 -0
- baseapp_wagtail/medias/tests/test_medias_wagtail_hooks.py +42 -0
- baseapp_wagtail/medias/wagtail_hooks.py +19 -0
- baseapp_wagtail/settings.py +84 -0
- baseapp_wagtail/setup_test_migrations.sh +22 -0
- baseapp_wagtail/static/baseapp_wagtail/js/section-stream-block.js +77 -0
- baseapp_wagtail/templates/blocks/empty.html +3 -0
- baseapp_wagtail/templates/pages/empty.html +3 -0
- baseapp_wagtail/templates/wagtailadmin/shared/page_status_tag.html +12 -0
- baseapp_wagtail/tests/apps.py +5 -0
- baseapp_wagtail/tests/conftest.py +1 -0
- baseapp_wagtail/tests/factories/wagtail_factories.py +25 -0
- baseapp_wagtail/tests/migrations/0001_initial.py +279 -0
- baseapp_wagtail/tests/migrations/0002_delete_standardpage.py +16 -0
- baseapp_wagtail/tests/migrations/__init__.py +0 -0
- baseapp_wagtail/tests/mixins.py +94 -0
- baseapp_wagtail/tests/models.py +28 -0
- baseapp_wagtail/tests/utils/blocks_helpers.py +43 -0
- baseapp_wagtail/tests/utils/media_helper.py +18 -0
- baseapp_wagtail/urls.py +19 -0
baseapp/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# BaseApp
|
|
2
|
+
|
|
3
|
+
BaseApp is a Django project template that provides a set of tools and best practices for building web applications.
|
|
4
|
+
|
|
5
|
+
## Requirements:
|
|
6
|
+
|
|
7
|
+
Run `pip install baseapp-backend`
|
|
8
|
+
And make sure to add the frozen version to your `requirements/base.txt` file
|
|
9
|
+
|
|
10
|
+
If you want to develop, [install using this other guide](#how-to-develop).
|
|
11
|
+
|
|
12
|
+
## How to use
|
|
13
|
+
|
|
14
|
+
Then enable the desired apps in your Django project's `INSTALLED_APPS` setting:
|
|
15
|
+
|
|
16
|
+
```python
|
|
17
|
+
INSTALLED_APPS = [
|
|
18
|
+
...
|
|
19
|
+
'baseapp.activity_log',
|
|
20
|
+
...
|
|
21
|
+
]
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Features
|
|
25
|
+
|
|
26
|
+
## How to develop
|
|
27
|
+
|
|
28
|
+
Clone the project inside your project's backend dir:
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
git clone git@github.com:silverlogic/baseapp-backend.git
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
And manually install the package:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
pip install -e baseapp-backend/baseapp
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The `-e` flag will make it like any change you make in the cloned repo files will effect into the project.
|
baseapp/__init__.py
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# BaseApp Activity Log
|
|
2
|
+
|
|
3
|
+
This app exposes an API to view user's activities that are being tracked by the system.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
### Requirements:
|
|
8
|
+
|
|
9
|
+
You need to have [django-pghistory](https://github.com/Opus10/django-pghistory) installed in your project and models that you want to track should be tracked by pghistory:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
import pghistory
|
|
13
|
+
|
|
14
|
+
@pghistory.track()
|
|
15
|
+
class TrackedModel(models.Model):
|
|
16
|
+
int_field = models.IntegerField()
|
|
17
|
+
text_field = models.TextField()
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Add `baseapp.activity_log` to your `INSTALLED_APPS` setting:
|
|
21
|
+
|
|
22
|
+
```python
|
|
23
|
+
INSTALLED_APPS = [
|
|
24
|
+
...
|
|
25
|
+
'baseapp.activity_log',
|
|
26
|
+
]
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Add `HistoryMiddleware` to the `MIDDLEWARE` list in the `settings.py` file:
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
MIDDLEWARE = [
|
|
33
|
+
...
|
|
34
|
+
'baseapp.activity_log.middleware.HistoryMiddleware',
|
|
35
|
+
]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Add `ActivityLogPermissionsBackend` to the `AUTHENTICATION_BACKENDS` list in the `settings.py` file:
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
AUTHENTICATION_BACKENDS = [
|
|
42
|
+
...
|
|
43
|
+
"baseapp.activity_log.permissions.ActivityLogPermissionsBackend",
|
|
44
|
+
]
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Add `ActivityLogQueries` to your GraphQL schema:
|
|
48
|
+
|
|
49
|
+
```python
|
|
50
|
+
from baseapp.activity_log.schema import ActivityLogQueries
|
|
51
|
+
|
|
52
|
+
class Query(ActivityLogQueries, graphene.ObjectType):
|
|
53
|
+
pass
|
|
54
|
+
|
|
55
|
+
schema = graphene.Schema(query=Query)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Usage
|
|
59
|
+
|
|
60
|
+
By default users only have access to public activities. To log an activity as public use the `set_public_activity` function:
|
|
61
|
+
|
|
62
|
+
```python
|
|
63
|
+
from baseapp.activity_log.context import set_public_activity
|
|
64
|
+
|
|
65
|
+
def create_comment(request, body):
|
|
66
|
+
# ...
|
|
67
|
+
set_public_activity(verb="baseapp_comments.add_comment")
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### GraphQL
|
|
71
|
+
|
|
72
|
+
This packages provides the following interfaces that can be used to expose the activity logs for user, profile and specific models:
|
|
73
|
+
|
|
74
|
+
- `NodeActivityLogInterface`
|
|
75
|
+
- `UserActivityLog`
|
|
76
|
+
- `ProfileActivityLog`
|
|
77
|
+
|
|
78
|
+
This app also exposes a query to fetch a global list of activities:
|
|
79
|
+
|
|
80
|
+
```graphql
|
|
81
|
+
{
|
|
82
|
+
activityLogs(visibility: PUBLIC, first: 10) {
|
|
83
|
+
edges {
|
|
84
|
+
node {
|
|
85
|
+
id
|
|
86
|
+
verb
|
|
87
|
+
profile {
|
|
88
|
+
name
|
|
89
|
+
}
|
|
90
|
+
events {
|
|
91
|
+
diff
|
|
92
|
+
label
|
|
93
|
+
obj {
|
|
94
|
+
... on Comment {
|
|
95
|
+
body
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
createdAt
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
from typing import Any
|
|
2
|
+
|
|
3
|
+
import pghistory
|
|
4
|
+
|
|
5
|
+
from .models import VisibilityTypes
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def set_public_activity(verb: str, **kwargs: Any) -> None:
|
|
9
|
+
"""Set public visibility context for activity logging.
|
|
10
|
+
|
|
11
|
+
Args:
|
|
12
|
+
verb: The action verb describing the activity (e.g., 'create', 'update')
|
|
13
|
+
**kwargs: Additional context parameters to be logged
|
|
14
|
+
"""
|
|
15
|
+
pghistory.context(visibility=VisibilityTypes.PUBLIC, verb=verb, **kwargs)
|
|
File without changes
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import django_filters
|
|
2
|
+
from django.core.exceptions import ValidationError
|
|
3
|
+
from django.db.models import Q
|
|
4
|
+
|
|
5
|
+
from ..models import ActivityLog
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ActivityLogFilter(django_filters.FilterSet):
|
|
9
|
+
created_from = django_filters.DateFilter(field_name="created_at", lookup_expr="date__gte")
|
|
10
|
+
created_to = django_filters.DateFilter(field_name="created_at", lookup_expr="date__lte")
|
|
11
|
+
user_pk = django_filters.NumberFilter(field_name="user_id")
|
|
12
|
+
profile_pk = django_filters.NumberFilter(field_name="profile_id")
|
|
13
|
+
user_name = django_filters.CharFilter(method="filter_user_name")
|
|
14
|
+
|
|
15
|
+
def filter_user_name(self, queryset, name, value):
|
|
16
|
+
return queryset.filter(
|
|
17
|
+
Q(user__profile__name__icontains=value) | Q(user__email__icontains=value)
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
def filter_queryset(self, queryset):
|
|
21
|
+
created_from = self.data.get("created_from")
|
|
22
|
+
created_to = self.data.get("created_to")
|
|
23
|
+
|
|
24
|
+
if created_from and created_to and created_from > created_to:
|
|
25
|
+
raise ValidationError("`created_from` must be earlier than or equal to `created_to`.")
|
|
26
|
+
return super().filter_queryset(queryset)
|
|
27
|
+
|
|
28
|
+
class Meta:
|
|
29
|
+
model = ActivityLog
|
|
30
|
+
fields = ["created_from", "created_to", "user_pk", "profile_pk", "user_name"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class MiddlewareEventFilter(django_filters.FilterSet):
|
|
34
|
+
created_from = django_filters.DateFilter(field_name="pgh_created_at__gte")
|
|
35
|
+
created_to = django_filters.DateFilter(field_name="pgh_created_at__lte")
|
|
36
|
+
user_pk = django_filters.NumberFilter(field_name="user_id")
|
|
37
|
+
|
|
38
|
+
class Meta:
|
|
39
|
+
model = ActivityLog
|
|
40
|
+
fields = ["created_from", "created_to", "user_pk"]
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import graphene
|
|
2
|
+
from graphene_django.filter import DjangoFilterConnectionField
|
|
3
|
+
|
|
4
|
+
from ..models import ActivityLog
|
|
5
|
+
from .object_types import ActivityLogObjectType, VisibilityTypesEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class NodeActivityLogInterface(graphene.Interface):
|
|
9
|
+
node_activity_logs = DjangoFilterConnectionField(
|
|
10
|
+
ActivityLogObjectType,
|
|
11
|
+
visibility=VisibilityTypesEnum(),
|
|
12
|
+
first=graphene.Int(default_value=10),
|
|
13
|
+
max_limit=100,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
def resolve_node_activity_logs(self, info, **kwargs):
|
|
17
|
+
if not info.context.user.has_perm("activity_log.list_node_activitylog", self):
|
|
18
|
+
return ActivityLog.objects.none()
|
|
19
|
+
context_ids = self.pgh_event_model.objects.filter(pgh_obj_id=self.pk).values_list(
|
|
20
|
+
"pgh_context_id", flat=True
|
|
21
|
+
)
|
|
22
|
+
return ActivityLog.objects.filter(pk__in=context_ids)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class UserActivityLog:
|
|
26
|
+
activity_logs = DjangoFilterConnectionField(
|
|
27
|
+
ActivityLogObjectType,
|
|
28
|
+
visibility=VisibilityTypesEnum(),
|
|
29
|
+
first=graphene.Int(default_value=10),
|
|
30
|
+
max_limit=100,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
def resolve_activity_logs(self, info, **kwargs):
|
|
34
|
+
if not info.context.user.has_perm("activity_log.list_user_activitylog", self):
|
|
35
|
+
return ActivityLog.objects.none()
|
|
36
|
+
return ActivityLog.objects.filter(user_id=self.pk)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class ProfileActivityLog:
|
|
40
|
+
activity_logs = DjangoFilterConnectionField(
|
|
41
|
+
ActivityLogObjectType,
|
|
42
|
+
visibility=VisibilityTypesEnum(),
|
|
43
|
+
first=graphene.Int(default_value=10),
|
|
44
|
+
max_limit=100,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
def resolve_activity_logs(self, info, **kwargs):
|
|
48
|
+
if not info.context.user.has_perm("activity_log.list_profile_activitylog", self):
|
|
49
|
+
return ActivityLog.objects.none()
|
|
50
|
+
return ActivityLog.objects.filter(profile_id=self.pk)
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import graphene
|
|
2
|
+
import swapper
|
|
3
|
+
from django.apps import apps
|
|
4
|
+
from django.contrib.auth import get_user_model
|
|
5
|
+
from graphene.types.generic import GenericScalar
|
|
6
|
+
from graphene_django.filter import DjangoFilterConnectionField
|
|
7
|
+
from pghistory.models import MiddlewareEvents
|
|
8
|
+
|
|
9
|
+
from baseapp_core.graphql import DjangoObjectType
|
|
10
|
+
from baseapp_core.graphql import Node as RelayNode
|
|
11
|
+
from baseapp_core.graphql import get_object_type_for_model
|
|
12
|
+
|
|
13
|
+
from ..models import ActivityLog, VisibilityTypes
|
|
14
|
+
from .filters import ActivityLogFilter, MiddlewareEventFilter
|
|
15
|
+
|
|
16
|
+
User = get_user_model()
|
|
17
|
+
Profile = swapper.load_model("baseapp_profiles", "Profile")
|
|
18
|
+
VisibilityTypesEnum = graphene.Enum.from_enum(VisibilityTypes)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class NodeLogEventObjectType(DjangoObjectType):
|
|
22
|
+
obj = graphene.Field(RelayNode, description="The object of the event.")
|
|
23
|
+
label = graphene.String(description="The event label.")
|
|
24
|
+
data = GenericScalar(description="The raw data of the event.")
|
|
25
|
+
diff = GenericScalar(description="The diff between the previous event of the same label.")
|
|
26
|
+
created_at = graphene.DateTime(description="When the event was created.")
|
|
27
|
+
|
|
28
|
+
class Meta:
|
|
29
|
+
interfaces = (RelayNode,)
|
|
30
|
+
model = MiddlewareEvents
|
|
31
|
+
name = "NodeLogEvent"
|
|
32
|
+
fields = (
|
|
33
|
+
"id",
|
|
34
|
+
"obj",
|
|
35
|
+
"data",
|
|
36
|
+
"created_at",
|
|
37
|
+
"diff",
|
|
38
|
+
"user",
|
|
39
|
+
"label",
|
|
40
|
+
)
|
|
41
|
+
filterset_class = MiddlewareEventFilter
|
|
42
|
+
|
|
43
|
+
def resolve_data(self, info, **kwargs):
|
|
44
|
+
if info.context.user.has_perm("activity_log.view_nodelogevent-data", self):
|
|
45
|
+
return self.pgh_data
|
|
46
|
+
|
|
47
|
+
def resolve_obj(self, info, **kwargs):
|
|
48
|
+
Model = apps.get_model(self.pgh_obj_model)
|
|
49
|
+
try:
|
|
50
|
+
return Model.objects.get(pk=self.pgh_obj_id)
|
|
51
|
+
except Model.DoesNotExist:
|
|
52
|
+
return None
|
|
53
|
+
|
|
54
|
+
def resolve_created_at(self, info, **kwargs):
|
|
55
|
+
return self.pgh_created_at
|
|
56
|
+
|
|
57
|
+
def resolve_diff(self, info, **kwargs):
|
|
58
|
+
if info.context.user.has_perm("activity_log.view_nodelogevent-diff", self):
|
|
59
|
+
return self.pgh_diff
|
|
60
|
+
|
|
61
|
+
def resolve_label(self, info, **kwargs):
|
|
62
|
+
return self.pgh_label
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class BaseActivityLogObjectType:
|
|
66
|
+
metadata = GenericScalar()
|
|
67
|
+
events = DjangoFilterConnectionField(lambda: NodeLogEventObjectType)
|
|
68
|
+
user = graphene.Field(get_object_type_for_model(User))
|
|
69
|
+
profile = graphene.Field(get_object_type_for_model(Profile))
|
|
70
|
+
visibility = graphene.Field(VisibilityTypesEnum)
|
|
71
|
+
verb = graphene.String()
|
|
72
|
+
ip_address = graphene.String()
|
|
73
|
+
url = graphene.String()
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def get_node(cls, info, id):
|
|
77
|
+
try:
|
|
78
|
+
obj = cls._meta.model.objects.get(id=id)
|
|
79
|
+
if not info.context.user.has_perm("activity_log.view_activitylog", obj):
|
|
80
|
+
return None
|
|
81
|
+
return obj
|
|
82
|
+
|
|
83
|
+
except cls._meta.model.DoesNotExist:
|
|
84
|
+
return None
|
|
85
|
+
|
|
86
|
+
@classmethod
|
|
87
|
+
def get_queryset(cls, queryset, info):
|
|
88
|
+
if not info.context.user.has_perm("activity_log.list_activitylog_any_visibility"):
|
|
89
|
+
queryset = queryset.filter(visibility=VisibilityTypes.PUBLIC)
|
|
90
|
+
return queryset
|
|
91
|
+
|
|
92
|
+
class Meta:
|
|
93
|
+
interfaces = (RelayNode,)
|
|
94
|
+
model = ActivityLog
|
|
95
|
+
fields = (
|
|
96
|
+
"id",
|
|
97
|
+
"pk",
|
|
98
|
+
"user",
|
|
99
|
+
"url",
|
|
100
|
+
"verb",
|
|
101
|
+
"events",
|
|
102
|
+
"visibility",
|
|
103
|
+
"ip_address",
|
|
104
|
+
"created_at",
|
|
105
|
+
"updated_at",
|
|
106
|
+
)
|
|
107
|
+
filterset_class = ActivityLogFilter
|
|
108
|
+
|
|
109
|
+
def resolve_events(self, info, **kwargs):
|
|
110
|
+
return MiddlewareEvents.objects.filter(pgh_context_id=self.pk)
|
|
111
|
+
|
|
112
|
+
def resolve_user(self, info, **kwargs):
|
|
113
|
+
user_id = getattr(self, "user_id", None)
|
|
114
|
+
if user_id is not None:
|
|
115
|
+
try:
|
|
116
|
+
return User.objects.get(pk=user_id)
|
|
117
|
+
except User.DoesNotExist:
|
|
118
|
+
return None
|
|
119
|
+
return getattr(self, "user", None)
|
|
120
|
+
|
|
121
|
+
def resolve_profile(self, info, **kwargs):
|
|
122
|
+
profile_id = getattr(self, "profile_id", None)
|
|
123
|
+
if profile_id is not None:
|
|
124
|
+
try:
|
|
125
|
+
return Profile.objects.get(pk=profile_id)
|
|
126
|
+
except Profile.DoesNotExist:
|
|
127
|
+
return None
|
|
128
|
+
return getattr(self, "profile", None)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
class ActivityLogObjectType(BaseActivityLogObjectType, DjangoObjectType):
|
|
132
|
+
class Meta(BaseActivityLogObjectType.Meta):
|
|
133
|
+
pass
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import graphene
|
|
2
|
+
from graphene_django.filter import DjangoFilterConnectionField
|
|
3
|
+
|
|
4
|
+
from ..models import ActivityLog
|
|
5
|
+
from .object_types import ActivityLogObjectType, VisibilityTypesEnum
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ActivityLogQueries:
|
|
9
|
+
activity_logs = DjangoFilterConnectionField(
|
|
10
|
+
ActivityLogObjectType,
|
|
11
|
+
visibility=VisibilityTypesEnum(),
|
|
12
|
+
first=graphene.Int(default_value=10),
|
|
13
|
+
max_limit=100,
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
def resolve_activity_logs(self, info, visibility=None, **kwargs):
|
|
17
|
+
return ActivityLog.objects.all()
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import channels_graphql_ws
|
|
2
|
+
import graphene
|
|
3
|
+
from channels.db import database_sync_to_async
|
|
4
|
+
|
|
5
|
+
from baseapp_core.graphql import get_obj_from_relay_id
|
|
6
|
+
|
|
7
|
+
from .object_types import ActivityLogObjectType
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class OnNewActivityLogMessage(channels_graphql_ws.Subscription):
|
|
11
|
+
message = graphene.Field(lambda: ActivityLogObjectType._meta.connection.Edge)
|
|
12
|
+
|
|
13
|
+
class Arguments:
|
|
14
|
+
room_id = graphene.ID(required=True)
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def subscribe(root, info, room_id):
|
|
18
|
+
room = database_sync_to_async(get_obj_from_relay_id)(info, room_id)
|
|
19
|
+
|
|
20
|
+
user = info.context.channels_scope["user"]
|
|
21
|
+
if not user.is_authenticated or not database_sync_to_async(user.has_perm)(
|
|
22
|
+
"activity_log.view_activitylog", room
|
|
23
|
+
):
|
|
24
|
+
return []
|
|
25
|
+
return [room_id]
|
|
26
|
+
|
|
27
|
+
@staticmethod
|
|
28
|
+
def publish(payload, info, room_id):
|
|
29
|
+
message = payload["message"]
|
|
30
|
+
user = info.context.channels_scope["user"]
|
|
31
|
+
|
|
32
|
+
if not user.is_authenticated:
|
|
33
|
+
return None
|
|
34
|
+
|
|
35
|
+
return OnNewActivityLogMessage(
|
|
36
|
+
message=ActivityLogObjectType._meta.connection.Edge(node=message)
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
@classmethod
|
|
40
|
+
def new_message(cls, message, room_id):
|
|
41
|
+
cls.broadcast(
|
|
42
|
+
group=room_id,
|
|
43
|
+
payload={"message": message},
|
|
44
|
+
)
|
|
45
|
+
OnNewActivityLogMessage.new_message(message=message)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class ActivityLogSubscriptions:
|
|
49
|
+
on_new_activity_log = OnNewActivityLogMessage.Field()
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import pghistory
|
|
2
|
+
from django.core.handlers.asgi import ASGIRequest as DjangoASGIRequest
|
|
3
|
+
from django.core.handlers.wsgi import WSGIRequest as DjangoWSGIRequest
|
|
4
|
+
from ipware import get_client_ip
|
|
5
|
+
from pghistory import config
|
|
6
|
+
|
|
7
|
+
# The default meta precedence order
|
|
8
|
+
IPWARE_META_PRECEDENCE_ORDER = (
|
|
9
|
+
"X_FORWARDED_FOR",
|
|
10
|
+
"HTTP_X_FORWARDED_FOR",
|
|
11
|
+
"HTTP_CLIENT_IP",
|
|
12
|
+
"HTTP_X_REAL_IP",
|
|
13
|
+
"HTTP_X_FORWARDED",
|
|
14
|
+
"HTTP_X_CLUSTER_CLIENT_IP",
|
|
15
|
+
"HTTP_FORWARDED_FOR",
|
|
16
|
+
"HTTP_FORWARDED",
|
|
17
|
+
"HTTP_CF_CONNECTING_IP",
|
|
18
|
+
"X-CLIENT-IP",
|
|
19
|
+
"X-REAL-IP",
|
|
20
|
+
"X-CLUSTER-CLIENT-IP",
|
|
21
|
+
"X_FORWARDED",
|
|
22
|
+
"FORWARDED_FOR",
|
|
23
|
+
"CF-CONNECTING-IP",
|
|
24
|
+
"TRUE-CLIENT-IP",
|
|
25
|
+
"FASTLY-CLIENT-IP",
|
|
26
|
+
"FORWARDED",
|
|
27
|
+
"CLIENT-IP",
|
|
28
|
+
"REMOTE_ADDR",
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class DjangoRequest:
|
|
33
|
+
"""
|
|
34
|
+
Although Django's auth middleware sets the user in middleware,
|
|
35
|
+
apps like django-rest-framework set the user in the view layer.
|
|
36
|
+
This creates issues for pghistory tracking since the context needs
|
|
37
|
+
to be set before DB operations happen.
|
|
38
|
+
|
|
39
|
+
This special WSGIRequest updates pghistory context when
|
|
40
|
+
the request.user attribute is updated.
|
|
41
|
+
"""
|
|
42
|
+
|
|
43
|
+
def __setattr__(self, attr, value):
|
|
44
|
+
if attr == "user":
|
|
45
|
+
pghistory.context(user=value.pk if value and hasattr(value, "pk") else None)
|
|
46
|
+
|
|
47
|
+
return super().__setattr__(attr, value)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class WSGIRequest(DjangoRequest, DjangoWSGIRequest):
|
|
51
|
+
pass
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class ASGIRequest(DjangoRequest, DjangoASGIRequest):
|
|
55
|
+
pass
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def HistoryMiddleware(get_response):
|
|
59
|
+
def middleware(request):
|
|
60
|
+
if request.method in config.middleware_methods():
|
|
61
|
+
user = (
|
|
62
|
+
request.user.pk
|
|
63
|
+
if hasattr(request, "user") and hasattr(request.user, "pk")
|
|
64
|
+
else None
|
|
65
|
+
)
|
|
66
|
+
profile = (
|
|
67
|
+
request.user.current_profile.pk
|
|
68
|
+
if hasattr(request.user, "current_profile")
|
|
69
|
+
and hasattr(request.user.current_profile, "pk")
|
|
70
|
+
else None
|
|
71
|
+
)
|
|
72
|
+
client_ip, is_routable = get_client_ip(
|
|
73
|
+
request, request_header_order=IPWARE_META_PRECEDENCE_ORDER
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
with pghistory.context(
|
|
77
|
+
user=user,
|
|
78
|
+
profile=profile,
|
|
79
|
+
url=request.path,
|
|
80
|
+
ip_address=client_ip,
|
|
81
|
+
is_ip_routable=is_routable,
|
|
82
|
+
):
|
|
83
|
+
if isinstance(request, DjangoWSGIRequest): # pragma: no branch
|
|
84
|
+
request.__class__ = WSGIRequest
|
|
85
|
+
elif isinstance(request, DjangoASGIRequest): # pragma: no branch
|
|
86
|
+
request.__class__ = ASGIRequest
|
|
87
|
+
|
|
88
|
+
return get_response(request)
|
|
89
|
+
else:
|
|
90
|
+
return get_response(request)
|
|
91
|
+
|
|
92
|
+
return middleware
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Generated by Django 5.0.1 on 2024-11-03 00:29
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
initial = True
|
|
9
|
+
|
|
10
|
+
dependencies = [
|
|
11
|
+
("pghistory", "0006_delete_aggregateevent"),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.CreateModel(
|
|
16
|
+
name="ActivityLog",
|
|
17
|
+
fields=[],
|
|
18
|
+
options={
|
|
19
|
+
"proxy": True,
|
|
20
|
+
"indexes": [],
|
|
21
|
+
"constraints": [],
|
|
22
|
+
},
|
|
23
|
+
bases=("pghistory.context", models.Model),
|
|
24
|
+
),
|
|
25
|
+
]
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Generated by Django 5.1.4 on 2024-12-16 18:04
|
|
2
|
+
|
|
3
|
+
from django.db import migrations
|
|
4
|
+
|
|
5
|
+
CREATE_SQL = """
|
|
6
|
+
create or replace view v_activity_log as select
|
|
7
|
+
pc.id as id,
|
|
8
|
+
pc.created_at as created_at,
|
|
9
|
+
pc.updated_at as updated_at,
|
|
10
|
+
nullif(metadata->>'user', '')::int8 as user_id,
|
|
11
|
+
nullif(metadata->>'profile', '')::int8 as profile_id,
|
|
12
|
+
metadata->>'url' as url,
|
|
13
|
+
metadata->>'verb' as verb,
|
|
14
|
+
nullif(metadata->>'visibility', '')::int4 as visibility,
|
|
15
|
+
metadata->>'ip_address' as ip_address,
|
|
16
|
+
metadata
|
|
17
|
+
from pghistory_context pc
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
DROP_SQL = "drop view if exists v_activity_log"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class Migration(migrations.Migration):
|
|
24
|
+
|
|
25
|
+
dependencies = [
|
|
26
|
+
("baseapp_activity_log", "0001_initial"),
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
operations = [migrations.RunSQL(sql=CREATE_SQL, reverse_sql=DROP_SQL)]
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# Generated by Django 5.1.4 on 2024-12-16 18:08
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Migration(migrations.Migration):
|
|
7
|
+
|
|
8
|
+
dependencies = [
|
|
9
|
+
("baseapp_activity_log", "0002_auto_20241216_1804"),
|
|
10
|
+
]
|
|
11
|
+
|
|
12
|
+
operations = [
|
|
13
|
+
migrations.DeleteModel(
|
|
14
|
+
name="ActivityLog",
|
|
15
|
+
),
|
|
16
|
+
migrations.CreateModel(
|
|
17
|
+
name="ActivityLog",
|
|
18
|
+
fields=[
|
|
19
|
+
(
|
|
20
|
+
"id",
|
|
21
|
+
models.BigAutoField(
|
|
22
|
+
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
|
23
|
+
),
|
|
24
|
+
),
|
|
25
|
+
("created_at", models.DateTimeField()),
|
|
26
|
+
("updated_at", models.DateTimeField()),
|
|
27
|
+
("ip_address", models.TextField()),
|
|
28
|
+
("verb", models.TextField()),
|
|
29
|
+
("visibility", models.TextField()),
|
|
30
|
+
("url", models.TextField()),
|
|
31
|
+
("metadata", models.JSONField()),
|
|
32
|
+
],
|
|
33
|
+
options={
|
|
34
|
+
"db_table": "v_activity_log",
|
|
35
|
+
"managed": False,
|
|
36
|
+
},
|
|
37
|
+
),
|
|
38
|
+
]
|
|
File without changes
|