wagtail 6.2.2__py3-none-any.whl → 6.3rc2__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.
- wagtail/__init__.py +1 -1
- wagtail/actions/copy_for_translation.py +6 -0
- wagtail/actions/publish_revision.py +3 -3
- wagtail/admin/action_menu.py +5 -3
- wagtail/admin/forms/account.py +1 -1
- wagtail/admin/icons.py +2 -6
- wagtail/admin/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/cy/LC_MESSAGES/django.po +32 -0
- wagtail/admin/locale/dv/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/dv/LC_MESSAGES/django.po +28 -0
- wagtail/admin/locale/en/LC_MESSAGES/django.po +451 -485
- wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +7 -7
- wagtail/admin/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/sl/LC_MESSAGES/django.po +150 -0
- wagtail/admin/locale/sl/LC_MESSAGES/djangojs.mo +0 -0
- wagtail/admin/locale/sl/LC_MESSAGES/djangojs.po +9 -2
- wagtail/admin/locale/ug/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/ug/LC_MESSAGES/django.po +3250 -196
- wagtail/admin/localization.py +12 -2
- wagtail/admin/panels/model_utils.py +1 -1
- wagtail/admin/site_summary.py +0 -2
- wagtail/admin/static/wagtailadmin/css/core.css +1 -1
- wagtail/admin/static/wagtailadmin/css/panels/draftail.css +1 -1
- wagtail/admin/static/wagtailadmin/images/email-header.jpg +0 -0
- wagtail/admin/static/wagtailadmin/js/bulk-actions.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js.LICENSE.txt +12 -0
- wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
- wagtail/admin/static/wagtailadmin/js/sidebar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/widgets.js +1 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js.LICENSE.txt +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor.js +1 -1
- wagtail/admin/static/wagtailadmin/js/wagtailadmin.js +1 -1
- wagtail/admin/static/wagtailadmin/js/workflow-action.js +1 -1
- wagtail/admin/staticfiles.py +6 -4
- wagtail/admin/templates/wagtailadmin/account/account.html +42 -59
- wagtail/admin/templates/wagtailadmin/admin_base.html +0 -28
- wagtail/admin/templates/wagtailadmin/bulk_actions/footer.html +1 -1
- wagtail/admin/templates/wagtailadmin/chooser/_search_results.html +7 -5
- wagtail/admin/templates/wagtailadmin/chooser/tables/page_navigate_to_children_cell.html +1 -1
- wagtail/admin/templates/wagtailadmin/generic/chooser/results.html +7 -5
- wagtail/admin/templates/wagtailadmin/generic/edit.html +0 -8
- wagtail/admin/templates/wagtailadmin/generic/form.html +60 -17
- wagtail/admin/templates/wagtailadmin/generic/index.html +17 -0
- wagtail/admin/templates/wagtailadmin/generic/index_results.html +9 -35
- wagtail/admin/templates/wagtailadmin/generic/inspect.html +2 -21
- wagtail/admin/templates/wagtailadmin/generic/listing.html +11 -17
- wagtail/admin/templates/wagtailadmin/generic/listing_results.html +19 -1
- wagtail/admin/templates/wagtailadmin/home/account_summary.html +26 -0
- wagtail/admin/templates/wagtailadmin/home/locked_pages.html +28 -18
- wagtail/admin/templates/wagtailadmin/home/recent_edits.html +28 -17
- wagtail/admin/templates/wagtailadmin/home/site_summary_pages.html +2 -2
- wagtail/admin/templates/wagtailadmin/home/upgrade_notification.html +35 -13
- wagtail/admin/templates/wagtailadmin/home/user_objects_in_workflow_moderation.html +28 -18
- wagtail/admin/templates/wagtailadmin/home/workflow_objects_to_moderate.html +43 -32
- wagtail/admin/templates/wagtailadmin/home.html +22 -5
- wagtail/admin/templates/wagtailadmin/pages/_editor_js.html +0 -1
- wagtail/admin/templates/wagtailadmin/pages/action_menu/menu.html +1 -11
- wagtail/admin/templates/wagtailadmin/pages/action_menu/menu_item.html +1 -6
- wagtail/admin/templates/wagtailadmin/pages/action_menu/page_locked.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/action_menu/publish.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/action_menu/save_draft.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/bulk_actions/confirm_bulk_delete.html +12 -6
- wagtail/admin/templates/wagtailadmin/pages/bulk_actions/confirm_bulk_move.html +12 -7
- wagtail/admin/templates/wagtailadmin/pages/bulk_actions/confirm_bulk_publish.html +17 -11
- wagtail/admin/templates/wagtailadmin/pages/bulk_actions/confirm_bulk_unpublish.html +15 -9
- wagtail/admin/templates/wagtailadmin/pages/confirm_delete.html +9 -9
- wagtail/admin/templates/wagtailadmin/pages/confirm_move.html +2 -2
- wagtail/admin/templates/wagtailadmin/pages/confirm_unpublish.html +4 -4
- wagtail/admin/templates/wagtailadmin/pages/create.html +15 -34
- wagtail/admin/templates/wagtailadmin/pages/edit.html +15 -30
- wagtail/admin/templates/wagtailadmin/pages/explorable_index.html +6 -0
- wagtail/admin/templates/wagtailadmin/pages/explorable_index_results.html +60 -0
- wagtail/admin/templates/wagtailadmin/pages/index.html +1 -36
- wagtail/admin/templates/wagtailadmin/pages/index_results.html +2 -50
- wagtail/admin/templates/wagtailadmin/pages/listing/_locked_indicator.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/listing/_ordering_cell.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/listing/_page_header_buttons.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/listing/_page_title_column_header.html +3 -3
- wagtail/admin/templates/wagtailadmin/pages/listing/_pagination.html +1 -1
- wagtail/admin/templates/wagtailadmin/pages/listing.html +24 -0
- wagtail/admin/templates/wagtailadmin/pages/search.html +1 -20
- wagtail/admin/templates/wagtailadmin/pages/search_results.html +27 -25
- wagtail/admin/templates/wagtailadmin/permissions/includes/collection_member_permissions_formset.html +0 -1
- wagtail/admin/templates/wagtailadmin/reports/listing/_list_page_report.html +2 -2
- wagtail/admin/templates/wagtailadmin/reports/listing/_list_page_types_usage.html +6 -6
- wagtail/admin/templates/wagtailadmin/reports/workflow_tasks_results.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/action_menu/menu.html +14 -0
- wagtail/admin/templates/wagtailadmin/shared/action_menu/menu_item.html +6 -0
- wagtail/admin/templates/wagtailadmin/shared/avatar.html +13 -3
- wagtail/admin/templates/wagtailadmin/shared/header.html +0 -5
- wagtail/admin/templates/wagtailadmin/shared/headers/slim_header.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/page_status_tag_new.html +4 -1
- wagtail/admin/templates/wagtailadmin/shared/pagination_nav.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/side_panel_toggle.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/locale.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/usage.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/side_panels/preview.html +94 -52
- wagtail/admin/templates/wagtailadmin/{pages/_unsaved_changes_warning.html → shared/unsaved_changes_warning.html} +4 -4
- wagtail/admin/templates/wagtailadmin/shared/usage_summary.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/detail.html +1 -7
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/listing.html +1 -0
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/{list.html → listing_results.html} +33 -35
- wagtail/admin/templates/wagtailadmin/tables/references_cell.html +1 -1
- wagtail/admin/templates/wagtailadmin/workflows/create.html +11 -36
- wagtail/admin/templates/wagtailadmin/workflows/create_task.html +0 -38
- wagtail/admin/templates/wagtailadmin/workflows/edit.html +44 -74
- wagtail/admin/templates/wagtailadmin/workflows/edit_task.html +27 -66
- wagtail/admin/templates/wagtailadmin/workflows/includes/task_usage_cell.html +4 -2
- wagtail/admin/templates/wagtailadmin/workflows/includes/workflow_tasks_cell.html +4 -4
- wagtail/admin/templates/wagtailadmin/workflows/includes/workflow_used_by_cell.html +15 -11
- wagtail/admin/templates/wagtailadmin/workflows/task_chooser/includes/results.html +7 -5
- wagtail/admin/templatetags/wagtailadmin_tags.py +51 -22
- wagtail/admin/tests/pages/test_content_type_use_view.py +82 -2
- wagtail/admin/tests/pages/test_edit_page.py +70 -0
- wagtail/admin/tests/pages/test_explorer_view.py +65 -4
- wagtail/admin/tests/pages/test_page_search.py +8 -7
- wagtail/admin/tests/pages/test_page_usage.py +3 -1
- wagtail/admin/tests/pages/test_preview.py +208 -63
- wagtail/admin/tests/pages/test_reorder_page.py +91 -1
- wagtail/admin/tests/pages/test_view_draft.py +32 -1
- wagtail/admin/tests/pages/test_workflow_history.py +288 -7
- wagtail/admin/tests/test_account_management.py +23 -3
- wagtail/admin/tests/test_audit_log.py +24 -2
- wagtail/admin/tests/test_collections_views.py +17 -5
- wagtail/admin/tests/test_dashboard.py +1 -1
- wagtail/admin/tests/test_edit_handlers.py +3 -2
- wagtail/admin/tests/test_icon_sprite.py +4 -0
- wagtail/admin/tests/test_privacy.py +5 -19
- wagtail/admin/tests/test_reports_views.py +1 -1
- wagtail/admin/tests/test_site_summary.py +3 -3
- wagtail/admin/tests/test_templatetags.py +27 -3
- wagtail/admin/tests/test_upgrade_notification.py +71 -18
- wagtail/admin/tests/test_views.py +2 -2
- wagtail/admin/tests/test_views_generic.py +13 -0
- wagtail/admin/tests/test_widgets.py +3 -3
- wagtail/admin/tests/test_workflows.py +172 -27
- wagtail/admin/tests/tests.py +1 -1
- wagtail/admin/tests/viewsets/test_model_viewset.py +55 -3
- wagtail/admin/ui/side_panels.py +19 -0
- wagtail/admin/ui/sidebar.py +4 -3
- wagtail/admin/ui/tables/__init__.py +14 -1
- wagtail/admin/ui/tables/pages.py +6 -1
- wagtail/admin/urls/pages.py +10 -1
- wagtail/admin/urls/workflows.py +6 -1
- wagtail/admin/views/account.py +5 -1
- wagtail/admin/views/collections.py +0 -2
- wagtail/admin/views/generic/base.py +118 -1
- wagtail/admin/views/generic/history.py +158 -26
- wagtail/admin/views/generic/models.py +113 -99
- wagtail/admin/views/home.py +24 -9
- wagtail/admin/views/page_privacy.py +54 -30
- wagtail/admin/views/pages/history.py +11 -4
- wagtail/admin/views/pages/listing.py +76 -89
- wagtail/admin/views/pages/preview.py +1 -1
- wagtail/admin/views/pages/search.py +27 -71
- wagtail/admin/views/pages/usage.py +63 -24
- wagtail/admin/views/pages/utils.py +4 -3
- wagtail/admin/views/reports/base.py +0 -6
- wagtail/admin/views/workflows.py +67 -25
- wagtail/admin/viewsets/model.py +4 -3
- wagtail/admin/widgets/chooser.py +2 -1
- wagtail/api/v2/tests/test_pages.py +15 -2
- wagtail/blocks/field_block.py +15 -3
- wagtail/blocks/static_block.py +3 -0
- wagtail/contrib/forms/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/forms/locale/cy/LC_MESSAGES/django.po +29 -1
- wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +15 -11
- wagtail/contrib/forms/templates/wagtailforms/confirm_delete.html +1 -0
- wagtail/contrib/forms/templates/wagtailforms/index.html +1 -1
- wagtail/contrib/forms/templates/wagtailforms/index_results.html +1 -1
- wagtail/contrib/forms/templates/wagtailforms/list_submissions.html +2 -1
- wagtail/contrib/forms/templates/wagtailforms/panels/form_responses_panel.html +2 -2
- wagtail/contrib/forms/tests/test_views.py +234 -35
- wagtail/contrib/forms/utils.py +8 -14
- wagtail/contrib/forms/views.py +72 -27
- wagtail/contrib/frontend_cache/backends/azure.py +1 -1
- wagtail/contrib/frontend_cache/backends/cloudfront.py +2 -2
- wagtail/contrib/frontend_cache/backends/dummy.py +11 -0
- wagtail/contrib/frontend_cache/tests.py +31 -37
- wagtail/contrib/frontend_cache/utils.py +12 -5
- wagtail/contrib/redirects/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/redirects/locale/cy/LC_MESSAGES/django.po +16 -1
- wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +20 -24
- wagtail/contrib/redirects/models.py +16 -1
- wagtail/contrib/redirects/signal_handlers.py +18 -3
- wagtail/contrib/redirects/templates/wagtailredirects/add.html +5 -16
- wagtail/contrib/redirects/templates/wagtailredirects/import_summary.html +1 -1
- wagtail/contrib/redirects/tests/test_redirects.py +49 -6
- wagtail/contrib/redirects/tests/test_signal_handlers.py +42 -1
- wagtail/contrib/redirects/views.py +27 -3
- wagtail/contrib/search_promotions/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/search_promotions/locale/cy/LC_MESSAGES/django.po +60 -1
- wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +12 -18
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/add.html +5 -8
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/edit.html +15 -10
- wagtail/contrib/search_promotions/tests.py +13 -2
- wagtail/contrib/search_promotions/views.py +15 -3
- wagtail/contrib/settings/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/cy/LC_MESSAGES/django.po +6 -1
- wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +2 -10
- wagtail/contrib/settings/templates/wagtailsettings/edit.html +12 -45
- wagtail/contrib/simple_translation/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/simple_translation/locale/cy/LC_MESSAGES/django.po +13 -1
- wagtail/contrib/simple_translation/locale/dv/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/simple_translation/locale/dv/LC_MESSAGES/django.po +3 -0
- wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +4 -4
- wagtail/contrib/simple_translation/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/simple_translation/locale/sl/LC_MESSAGES/django.po +5 -2
- wagtail/contrib/simple_translation/tests/test_views.py +51 -0
- wagtail/contrib/simple_translation/wagtail_hooks.py +16 -11
- wagtail/contrib/styleguide/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/styleguide/locale/cy/LC_MESSAGES/django.po +5 -1
- wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/table_block/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/table_block/locale/cy/LC_MESSAGES/django.po +27 -1
- wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/typed_table_block/blocks.py +25 -0
- wagtail/contrib/typed_table_block/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/typed_table_block/locale/cy/LC_MESSAGES/django.po +12 -1
- wagtail/contrib/typed_table_block/locale/en/LC_MESSAGES/django.po +10 -10
- wagtail/contrib/typed_table_block/tests.py +24 -1
- wagtail/coreutils.py +5 -11
- wagtail/documents/admin_urls.py +2 -2
- wagtail/documents/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/cy/LC_MESSAGES/django.po +10 -0
- wagtail/documents/locale/en/LC_MESSAGES/django.po +61 -76
- wagtail/documents/migrations/0014_alter_document_file_size.py +18 -0
- wagtail/documents/models.py +1 -1
- wagtail/documents/rich_text/__init__.py +1 -3
- wagtail/documents/static/wagtaildocs/js/add-multiple.js +1 -1
- wagtail/documents/templates/wagtaildocs/bulk_actions/confirm_bulk_add_tags.html +5 -1
- wagtail/documents/templates/wagtaildocs/bulk_actions/confirm_bulk_add_to_collection.html +5 -1
- wagtail/documents/templates/wagtaildocs/bulk_actions/confirm_bulk_delete.html +11 -5
- wagtail/documents/templates/wagtaildocs/documents/add.html +13 -41
- wagtail/documents/templates/wagtaildocs/documents/edit.html +28 -56
- wagtail/documents/templates/wagtaildocs/documents/index.html +1 -4
- wagtail/documents/templates/wagtaildocs/homepage/site_summary_documents.html +2 -2
- wagtail/documents/templates/wagtaildocs/multiple/add.html +36 -41
- wagtail/documents/tests/test_admin_views.py +64 -6
- wagtail/documents/tests/test_site_summary.py +3 -3
- wagtail/documents/views/documents.py +103 -113
- wagtail/documents/views/multiple.py +19 -1
- wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/embeds/oembed_providers.py +9 -19
- wagtail/fields.py +43 -27
- wagtail/images/admin_urls.py +2 -2
- wagtail/images/blocks.py +230 -2
- wagtail/images/fields.py +17 -29
- wagtail/images/image_operations.py +1 -1
- wagtail/images/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/cy/LC_MESSAGES/django.po +128 -1
- wagtail/images/locale/en/LC_MESSAGES/django.po +119 -129
- wagtail/images/migrations/0025_alter_image_file_alter_rendition_file.py +36 -43
- wagtail/images/migrations/0027_image_description.py +20 -0
- wagtail/images/models.py +120 -45
- wagtail/images/rich_text/__init__.py +1 -3
- wagtail/images/static/wagtailimages/js/add-multiple.js +1 -1
- wagtail/images/static/wagtailimages/js/image-block.js +1 -0
- wagtail/images/templates/wagtailimages/bulk_actions/confirm_bulk_add_tags.html +5 -1
- wagtail/images/templates/wagtailimages/bulk_actions/confirm_bulk_add_to_collection.html +5 -1
- wagtail/images/templates/wagtailimages/bulk_actions/confirm_bulk_delete.html +11 -5
- wagtail/images/templates/wagtailimages/chooser/results.html +2 -2
- wagtail/images/templates/wagtailimages/homepage/site_summary_images.html +2 -2
- wagtail/images/templates/wagtailimages/images/_file_field.html +2 -2
- wagtail/images/templates/wagtailimages/images/add.html +13 -31
- wagtail/images/templates/wagtailimages/images/edit.html +53 -82
- wagtail/images/templates/wagtailimages/images/index.html +1 -4
- wagtail/images/templates/wagtailimages/images/url_generator.html +1 -1
- wagtail/images/templates/wagtailimages/multiple/add.html +40 -47
- wagtail/images/templates/wagtailimages/widgets/image.html +5 -0
- wagtail/images/templates/wagtailimages/widgets/image_chooser.html +1 -1
- wagtail/images/tests/test_admin_views.py +70 -10
- wagtail/images/tests/test_blocks.py +367 -1
- wagtail/images/tests/test_image_operations.py +23 -0
- wagtail/images/tests/test_models.py +20 -0
- wagtail/images/tests/test_signal_handlers.py +99 -95
- wagtail/images/tests/test_site_summary.py +3 -3
- wagtail/images/tests/test_templatetags.py +11 -7
- wagtail/images/tests/tests.py +4 -0
- wagtail/images/views/images.py +103 -104
- wagtail/images/views/multiple.py +17 -1
- wagtail/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/cy/LC_MESSAGES/django.po +3 -0
- wagtail/locale/en/LC_MESSAGES/django.po +137 -125
- wagtail/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/sl/LC_MESSAGES/django.po +3 -0
- wagtail/locales/locale/en/LC_MESSAGES/django.po +8 -8
- wagtail/locales/views.py +4 -1
- wagtail/migrations/0089_log_entry_data_json_null_to_object.py +1 -7
- wagtail/models/__init__.py +122 -14
- wagtail/models/audit_log.py +1 -3
- wagtail/models/i18n.py +1 -2
- wagtail/project_template/Dockerfile +3 -3
- wagtail/project_template/requirements.txt +2 -2
- wagtail/query.py +17 -4
- wagtail/rich_text/__init__.py +2 -3
- wagtail/rich_text/pages.py +2 -4
- wagtail/rich_text/rewriters.py +2 -2
- wagtail/search/backends/database/mysql/query.py +3 -3
- wagtail/search/backends/database/sqlite/query.py +6 -6
- wagtail/search/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/sites/locale/en/LC_MESSAGES/django.po +6 -6
- wagtail/sites/views.py +0 -1
- wagtail/snippets/action_menu.py +14 -4
- wagtail/snippets/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/snippets/locale/cy/LC_MESSAGES/django.po +73 -1
- wagtail/snippets/locale/en/LC_MESSAGES/django.po +27 -33
- wagtail/snippets/static/wagtailsnippets/js/snippet-chooser-telepath.js +1 -1
- wagtail/snippets/static/wagtailsnippets/js/snippet-chooser.js +1 -1
- wagtail/snippets/templates/wagtailsnippets/bulk_actions/confirm_bulk_delete.html +5 -3
- wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/locked.html +1 -1
- wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/menu.html +1 -11
- wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/menu_item.html +1 -6
- wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/publish.html +1 -1
- wagtail/snippets/templates/wagtailsnippets/snippets/action_menu/save.html +1 -1
- wagtail/snippets/templates/wagtailsnippets/snippets/create.html +1 -18
- wagtail/snippets/templates/wagtailsnippets/snippets/edit.html +1 -14
- wagtail/snippets/templates/wagtailsnippets/snippets/index.html +2 -5
- wagtail/snippets/tests/test_preview.py +193 -61
- wagtail/snippets/tests/test_snippets.py +247 -38
- wagtail/snippets/tests/test_usage.py +5 -0
- wagtail/snippets/tests/test_viewset.py +25 -9
- wagtail/snippets/tests/test_workflows.py +232 -19
- wagtail/snippets/views/snippets.py +1 -10
- wagtail/test/numberformat.py +104 -0
- wagtail/test/settings.py +10 -0
- wagtail/test/settings_ui.py +2 -0
- wagtail/test/testapp/migrations/0010_alter_customimage_file_and_more.py +71 -78
- wagtail/test/testapp/migrations/0040_nocreatablesubpagetypespage_nosubpagetypespage.py +54 -0
- wagtail/test/testapp/migrations/0041_alter_jsonstreammodel_options.py +17 -0
- wagtail/test/testapp/migrations/0042_alter_customdocument_file_size_and_more.py +28 -0
- wagtail/test/testapp/migrations/0043_customimage_description.py +41 -0
- wagtail/test/testapp/migrations/0044_custompreviewsizesmodel_custompreviewsizespage.py +52 -0
- wagtail/test/testapp/migrations/0045_alter_streampage_body.py +52 -0
- wagtail/test/testapp/models.py +62 -4
- wagtail/test/testapp/rich_text.py +2 -2
- wagtail/test/testapp/templates/tests/form_page_landing.html +2 -1
- wagtail/test/testapp/urls.py +5 -0
- wagtail/test/testapp/views.py +5 -0
- wagtail/test/utils/page_tests.py +5 -5
- wagtail/test/utils/template_tests.py +2 -2
- wagtail/tests/test_blocks.py +15 -0
- wagtail/tests/test_page_permissions.py +109 -0
- wagtail/tests/test_revision_model.py +27 -0
- wagtail/tests/test_signals.py +21 -2
- wagtail/tests/test_tests.py +30 -0
- wagtail/users/locale/cy/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/cy/LC_MESSAGES/django.po +118 -1
- wagtail/users/locale/dv/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/dv/LC_MESSAGES/django.po +3 -0
- wagtail/users/locale/en/LC_MESSAGES/django.po +89 -113
- wagtail/users/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/sl/LC_MESSAGES/django.po +3 -0
- wagtail/users/migrations/0014_userprofile_contrast.py +23 -0
- wagtail/users/models.py +11 -0
- wagtail/users/templates/wagtailusers/bulk_actions/confirm_bulk_assign_role.html +5 -1
- wagtail/users/templates/wagtailusers/bulk_actions/confirm_bulk_delete.html +5 -1
- wagtail/users/templates/wagtailusers/bulk_actions/confirm_bulk_set_active_state.html +5 -1
- wagtail/users/templates/wagtailusers/groups/create.html +19 -17
- wagtail/users/templates/wagtailusers/groups/edit.html +2 -40
- wagtail/users/templates/wagtailusers/groups/includes/formatted_permissions.html +1 -62
- wagtail/users/templates/wagtailusers/groups/includes/page_permissions_formset.html +0 -1
- wagtail/users/templates/wagtailusers/users/create.html +46 -50
- wagtail/users/templates/wagtailusers/users/edit.html +45 -62
- wagtail/users/templates/wagtailusers/users/index.html +1 -4
- wagtail/users/templatetags/wagtailusers_tags.py +1 -5
- wagtail/users/tests/test_admin_views.py +85 -66
- wagtail/users/views/groups.py +4 -1
- wagtail/users/views/users.py +2 -0
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/METADATA +6 -6
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/RECORD +378 -367
- wagtail/admin/static/wagtailadmin/js/preview-panel.js +0 -2
- wagtail/admin/static/wagtailadmin/js/preview-panel.js.LICENSE.txt +0 -11
- wagtail/admin/templates/wagtailadmin/generic/history_results.html +0 -1
- wagtail/admin/templates/wagtailadmin/page_privacy/ancestor_privacy.html +0 -3
- wagtail/admin/templates/wagtailadmin/pages/usage_results.html +0 -6
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/index.html +0 -17
- wagtail/admin/templates/wagtailadmin/shared/workflow_history/results.html +0 -17
- wagtail/admin/templates/wagtailadmin/workflows/usage.html +0 -44
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/LICENSE +0 -0
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/WHEEL +0 -0
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/entry_points.txt +0 -0
- {wagtail-6.2.2.dist-info → wagtail-6.3rc2.dist-info}/top_level.txt +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
{% extends "wagtailadmin/base.html" %}
|
|
1
|
+
{% extends "wagtailadmin/generic/base.html" %}
|
|
2
2
|
{% load i18n %}
|
|
3
3
|
{% load l10n %}
|
|
4
4
|
{% load wagtailadmin_tags %}
|
|
@@ -9,43 +9,45 @@
|
|
|
9
9
|
{{ form_media.css }}
|
|
10
10
|
{% endblock %}
|
|
11
11
|
|
|
12
|
-
{% block
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
{% block main_content %}
|
|
13
|
+
<div class="drop-zone w-mt-8">
|
|
14
|
+
<p>{% trans "Drag and drop documents into this area to upload immediately." %}</p>
|
|
15
|
+
<p>{{ help_text }}</p>
|
|
15
16
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<div class="bar" style="width: 0%;">0%</div>
|
|
44
|
-
</div>
|
|
17
|
+
<form action="{% url 'wagtaildocs:add_multiple' %}" method="POST" enctype="multipart/form-data">
|
|
18
|
+
<div class="replace-file-input">
|
|
19
|
+
<button class="button bicolor button--icon">{% icon name="plus" wrapped=1 %}{% trans "Or choose from your computer" %}</button>
|
|
20
|
+
<input
|
|
21
|
+
id="fileupload"
|
|
22
|
+
multiple
|
|
23
|
+
name="files[]"
|
|
24
|
+
type="file"
|
|
25
|
+
data-max-title-length="{{ max_title_length|stringformat:'s'|default:'null' }}"
|
|
26
|
+
data-url="{% url 'wagtaildocs:add_multiple' %}"
|
|
27
|
+
>
|
|
28
|
+
</div>
|
|
29
|
+
{% csrf_token %}
|
|
30
|
+
{% if collections %}
|
|
31
|
+
{% trans "Add to collection:" as label_text %}
|
|
32
|
+
{% rawformattedfield label_text=label_text id_for_label="id_adddocument_collection" classname="w-mx-auto w-mt-4 w-grid w-justify-center" %}
|
|
33
|
+
<select id="id_adddocument_collection" name="collection">
|
|
34
|
+
{% for pk, display_name in collections.get_indented_choices %}
|
|
35
|
+
<option value="{{ pk|unlocalize }}"{% if pk|unlocalize == selected_collection_id %} selected{% endif %}>
|
|
36
|
+
{{ display_name }}
|
|
37
|
+
</option>
|
|
38
|
+
{% endfor %}
|
|
39
|
+
</select>
|
|
40
|
+
{% endrawformattedfield %}
|
|
41
|
+
{% endif %}
|
|
42
|
+
</form>
|
|
43
|
+
</div>
|
|
45
44
|
|
|
46
|
-
|
|
45
|
+
<div id="overall-progress" class="progress progress-secondary">
|
|
46
|
+
<div class="bar" style="width: 0%;">0%</div>
|
|
47
47
|
</div>
|
|
48
48
|
|
|
49
|
+
<ul id="upload-list" class="upload-list multiple"></ul>
|
|
50
|
+
|
|
49
51
|
<template id="upload-list-item">
|
|
50
52
|
<li class="row">
|
|
51
53
|
<div class="left col3">
|
|
@@ -78,11 +80,4 @@
|
|
|
78
80
|
|
|
79
81
|
<!-- Main script -->
|
|
80
82
|
<script src="{% versioned_static 'wagtaildocs/js/add-multiple.js' %}"></script>
|
|
81
|
-
|
|
82
|
-
<script>
|
|
83
|
-
window.fileupload_opts = {
|
|
84
|
-
max_title_length: {{ max_title_length|stringformat:"s"|default:"null" }}, //numeric format
|
|
85
|
-
simple_upload_url: "{% url 'wagtaildocs:add' %}"
|
|
86
|
-
}
|
|
87
|
-
</script>
|
|
88
83
|
{% endblock %}
|
|
@@ -9,6 +9,7 @@ from django.test.utils import override_settings
|
|
|
9
9
|
from django.urls import reverse
|
|
10
10
|
from django.utils.html import escape
|
|
11
11
|
from django.utils.http import urlencode
|
|
12
|
+
from django.utils.text import capfirst
|
|
12
13
|
|
|
13
14
|
from wagtail.admin.admin_url_finder import AdminURLFinder
|
|
14
15
|
from wagtail.documents import get_document_model, models
|
|
@@ -28,6 +29,7 @@ from wagtail.test.testapp.models import (
|
|
|
28
29
|
VariousOnDeleteModel,
|
|
29
30
|
)
|
|
30
31
|
from wagtail.test.utils import WagtailTestUtils
|
|
32
|
+
from wagtail.test.utils.template_tests import AdminTemplateTestUtils
|
|
31
33
|
|
|
32
34
|
|
|
33
35
|
class TestDocumentIndexView(WagtailTestUtils, TestCase):
|
|
@@ -71,7 +73,11 @@ class TestDocumentIndexView(WagtailTestUtils, TestCase):
|
|
|
71
73
|
response = self.get({"p": "Hello World!"})
|
|
72
74
|
|
|
73
75
|
# Check response
|
|
74
|
-
self.assertEqual(response.status_code,
|
|
76
|
+
self.assertEqual(response.status_code, 200)
|
|
77
|
+
self.assertTemplateUsed(response, "wagtaildocs/documents/index.html")
|
|
78
|
+
|
|
79
|
+
# Check that we got page one
|
|
80
|
+
self.assertEqual(response.context["page_obj"].number, 1)
|
|
75
81
|
|
|
76
82
|
def test_pagination_out_of_range(self):
|
|
77
83
|
self.make_docs()
|
|
@@ -79,7 +85,14 @@ class TestDocumentIndexView(WagtailTestUtils, TestCase):
|
|
|
79
85
|
response = self.get({"p": 99999})
|
|
80
86
|
|
|
81
87
|
# Check response
|
|
82
|
-
self.assertEqual(response.status_code,
|
|
88
|
+
self.assertEqual(response.status_code, 200)
|
|
89
|
+
self.assertTemplateUsed(response, "wagtaildocs/documents/index.html")
|
|
90
|
+
|
|
91
|
+
# Check that we got the last page
|
|
92
|
+
self.assertEqual(
|
|
93
|
+
response.context["page_obj"].number,
|
|
94
|
+
response.context["paginator"].num_pages,
|
|
95
|
+
)
|
|
83
96
|
|
|
84
97
|
def test_ordering(self):
|
|
85
98
|
orderings = ["title", "-created_at"]
|
|
@@ -392,7 +405,7 @@ class TestDocumentIndexResultsView(WagtailTestUtils, TransactionTestCase):
|
|
|
392
405
|
self.assertContains(response, "<td>Root</td>", html=True)
|
|
393
406
|
|
|
394
407
|
|
|
395
|
-
class TestDocumentAddView(WagtailTestUtils, TestCase):
|
|
408
|
+
class TestDocumentAddView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
396
409
|
def setUp(self):
|
|
397
410
|
self.login()
|
|
398
411
|
|
|
@@ -414,6 +427,14 @@ class TestDocumentAddView(WagtailTestUtils, TestCase):
|
|
|
414
427
|
# draftail should NOT be a standard JS include on this page
|
|
415
428
|
self.assertNotContains(response, "wagtailadmin/js/draftail.js")
|
|
416
429
|
|
|
430
|
+
self.assertBreadcrumbsItemsRendered(
|
|
431
|
+
[
|
|
432
|
+
{"url": reverse("wagtaildocs:index"), "label": "Documents"},
|
|
433
|
+
{"url": "", "label": "New: Document"},
|
|
434
|
+
],
|
|
435
|
+
response.content,
|
|
436
|
+
)
|
|
437
|
+
|
|
417
438
|
def test_get_with_collections(self):
|
|
418
439
|
root_collection = Collection.get_first_root_node()
|
|
419
440
|
root_collection.add_child(name="Evil plans")
|
|
@@ -606,7 +627,7 @@ class TestDocumentAddViewWithLimitedCollectionPermissions(WagtailTestUtils, Test
|
|
|
606
627
|
)
|
|
607
628
|
|
|
608
629
|
|
|
609
|
-
class TestDocumentEditView(WagtailTestUtils, TestCase):
|
|
630
|
+
class TestDocumentEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
610
631
|
def setUp(self):
|
|
611
632
|
self.user = self.login()
|
|
612
633
|
|
|
@@ -665,6 +686,14 @@ class TestDocumentEditView(WagtailTestUtils, TestCase):
|
|
|
665
686
|
# definitions are being respected)
|
|
666
687
|
self.assertNotContains(response, "wagtailadmin/js/draftail.js")
|
|
667
688
|
|
|
689
|
+
self.assertBreadcrumbsItemsRendered(
|
|
690
|
+
[
|
|
691
|
+
{"url": reverse("wagtaildocs:index"), "label": "Documents"},
|
|
692
|
+
{"url": "", "label": "Test document"},
|
|
693
|
+
],
|
|
694
|
+
response.content,
|
|
695
|
+
)
|
|
696
|
+
|
|
668
697
|
url_finder = AdminURLFinder(self.user)
|
|
669
698
|
expected_url = "/admin/documents/edit/%d/" % self.document.id
|
|
670
699
|
self.assertEqual(url_finder.get_edit_url(self.document), expected_url)
|
|
@@ -1013,7 +1042,7 @@ class TestDocumentDeleteView(WagtailTestUtils, TestCase):
|
|
|
1013
1042
|
self.assertContains(response, "This document is referenced 0 times")
|
|
1014
1043
|
|
|
1015
1044
|
|
|
1016
|
-
class TestMultipleDocumentUploader(WagtailTestUtils, TestCase):
|
|
1045
|
+
class TestMultipleDocumentUploader(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
1017
1046
|
"""
|
|
1018
1047
|
This tests the multiple document upload views located in wagtaildocs/views/multiple.py
|
|
1019
1048
|
"""
|
|
@@ -1052,6 +1081,17 @@ class TestMultipleDocumentUploader(WagtailTestUtils, TestCase):
|
|
|
1052
1081
|
self.assertEqual(response.status_code, 200)
|
|
1053
1082
|
self.assertTemplateUsed(response, "wagtaildocs/multiple/add.html")
|
|
1054
1083
|
|
|
1084
|
+
self.assertBreadcrumbsItemsRendered(
|
|
1085
|
+
[
|
|
1086
|
+
{
|
|
1087
|
+
"url": reverse("wagtaildocs:index"),
|
|
1088
|
+
"label": capfirst(self.doc._meta.verbose_name_plural),
|
|
1089
|
+
},
|
|
1090
|
+
{"url": "", "label": "Add documents"},
|
|
1091
|
+
],
|
|
1092
|
+
response.content,
|
|
1093
|
+
)
|
|
1094
|
+
|
|
1055
1095
|
# no collection chooser when only one collection exists
|
|
1056
1096
|
self.assertNotContains(response, "id_adddocument_collection")
|
|
1057
1097
|
|
|
@@ -2041,7 +2081,7 @@ class TestUsageCount(WagtailTestUtils, TestCase):
|
|
|
2041
2081
|
self.assertContains(response, "Used 0 times")
|
|
2042
2082
|
|
|
2043
2083
|
|
|
2044
|
-
class TestGetUsage(WagtailTestUtils, TestCase):
|
|
2084
|
+
class TestGetUsage(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
2045
2085
|
fixtures = ["test.json"]
|
|
2046
2086
|
|
|
2047
2087
|
def setUp(self):
|
|
@@ -2075,6 +2115,24 @@ class TestGetUsage(WagtailTestUtils, TestCase):
|
|
|
2075
2115
|
self.assertContains(response, "Christmas")
|
|
2076
2116
|
self.assertContains(response, '<table class="listing">')
|
|
2077
2117
|
self.assertContains(response, "<td>Event page</td>", html=True)
|
|
2118
|
+
self.assertBreadcrumbsItemsRendered(
|
|
2119
|
+
[
|
|
2120
|
+
{
|
|
2121
|
+
"url": reverse("wagtaildocs:index"),
|
|
2122
|
+
"label": "Documents",
|
|
2123
|
+
},
|
|
2124
|
+
{
|
|
2125
|
+
"url": reverse("wagtaildocs:edit", args=(1,)),
|
|
2126
|
+
"label": "test document",
|
|
2127
|
+
},
|
|
2128
|
+
{
|
|
2129
|
+
"url": "",
|
|
2130
|
+
"label": "Usage",
|
|
2131
|
+
"sublabel": "test document",
|
|
2132
|
+
},
|
|
2133
|
+
],
|
|
2134
|
+
response.content,
|
|
2135
|
+
)
|
|
2078
2136
|
|
|
2079
2137
|
def test_usage_page_no_usage(self):
|
|
2080
2138
|
response = self.client.get(reverse("wagtaildocs:document_usage", args=(1,)))
|
|
@@ -122,9 +122,9 @@ class TestDocumentsSummary(WagtailTestUtils, TestCase):
|
|
|
122
122
|
|
|
123
123
|
def test_user_sees_proper_doc_count(self):
|
|
124
124
|
cases = (
|
|
125
|
-
(self.superuser, "
|
|
126
|
-
(self.report_adder, "
|
|
127
|
-
(self.report_chooser, "
|
|
125
|
+
(self.superuser, "3 Documents"),
|
|
126
|
+
(self.report_adder, "2 Documents"),
|
|
127
|
+
(self.report_chooser, "2 Documents"),
|
|
128
128
|
)
|
|
129
129
|
for user, content in cases:
|
|
130
130
|
with self.subTest(user=user):
|
|
@@ -2,9 +2,7 @@ import os
|
|
|
2
2
|
|
|
3
3
|
from django.contrib.admin.utils import quote
|
|
4
4
|
from django.core.exceptions import PermissionDenied
|
|
5
|
-
from django.
|
|
6
|
-
from django.template.response import TemplateResponse
|
|
7
|
-
from django.urls import reverse
|
|
5
|
+
from django.http.response import HttpResponse as HttpResponse
|
|
8
6
|
from django.utils.functional import cached_property
|
|
9
7
|
from django.utils.http import urlencode
|
|
10
8
|
from django.utils.translation import gettext as _
|
|
@@ -78,7 +76,6 @@ class IndexView(generic.IndexView):
|
|
|
78
76
|
model = get_document_model()
|
|
79
77
|
add_item_label = gettext_lazy("Add a document")
|
|
80
78
|
show_other_searches = True
|
|
81
|
-
_show_breadcrumbs = True
|
|
82
79
|
|
|
83
80
|
def get_base_queryset(self):
|
|
84
81
|
# Get documents (filtered by user permission)
|
|
@@ -157,117 +154,108 @@ class IndexView(generic.IndexView):
|
|
|
157
154
|
return context
|
|
158
155
|
|
|
159
156
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
class CreateView(generic.CreateView):
|
|
158
|
+
permission_policy = permission_policy
|
|
159
|
+
index_url_name = "wagtaildocs:index"
|
|
160
|
+
add_url_name = "wagtaildocs:add"
|
|
161
|
+
edit_url_name = "wagtaildocs:edit"
|
|
162
|
+
error_message = gettext_lazy("The document could not be created due to errors.")
|
|
163
|
+
template_name = "wagtaildocs/documents/add.html"
|
|
164
|
+
header_icon = "doc-full-inverse"
|
|
165
|
+
_show_breadcrumbs = True
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
)
|
|
170
|
-
if form.is_valid():
|
|
171
|
-
form.save()
|
|
172
|
-
|
|
173
|
-
messages.success(
|
|
174
|
-
request,
|
|
175
|
-
_("Document '%(document_title)s' added.")
|
|
176
|
-
% {"document_title": doc.title},
|
|
177
|
-
buttons=[
|
|
178
|
-
messages.button(
|
|
179
|
-
reverse("wagtaildocs:edit", args=(doc.id,)), _("Edit")
|
|
180
|
-
)
|
|
181
|
-
],
|
|
182
|
-
)
|
|
183
|
-
return redirect("wagtaildocs:index")
|
|
184
|
-
else:
|
|
185
|
-
messages.error(request, _("The document could not be saved due to errors."))
|
|
186
|
-
else:
|
|
187
|
-
form = DocumentForm(user=request.user)
|
|
188
|
-
|
|
189
|
-
return TemplateResponse(
|
|
190
|
-
request,
|
|
191
|
-
"wagtaildocs/documents/add.html",
|
|
192
|
-
{
|
|
193
|
-
"form": form,
|
|
194
|
-
},
|
|
195
|
-
)
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
@permission_checker.require("change")
|
|
199
|
-
def edit(request, document_id):
|
|
200
|
-
Document = get_document_model()
|
|
201
|
-
DocumentForm = get_document_form(Document)
|
|
202
|
-
|
|
203
|
-
doc = get_object_or_404(Document, id=document_id)
|
|
204
|
-
|
|
205
|
-
if not permission_policy.user_has_permission_for_instance(
|
|
206
|
-
request.user, "change", doc
|
|
207
|
-
):
|
|
208
|
-
raise PermissionDenied
|
|
209
|
-
|
|
210
|
-
next_url = get_valid_next_url_from_request(request)
|
|
211
|
-
|
|
212
|
-
if request.method == "POST":
|
|
213
|
-
form = DocumentForm(
|
|
214
|
-
request.POST, request.FILES, instance=doc, user=request.user
|
|
215
|
-
)
|
|
216
|
-
if form.is_valid():
|
|
217
|
-
doc = form.save()
|
|
218
|
-
|
|
219
|
-
edit_url = reverse("wagtaildocs:edit", args=(doc.id,))
|
|
220
|
-
redirect_url = "wagtaildocs:index"
|
|
221
|
-
if next_url:
|
|
222
|
-
edit_url = f"{edit_url}?{urlencode({'next': next_url})}"
|
|
223
|
-
redirect_url = next_url
|
|
224
|
-
|
|
225
|
-
messages.success(
|
|
226
|
-
request,
|
|
227
|
-
_("Document '%(document_title)s' updated")
|
|
228
|
-
% {"document_title": doc.title},
|
|
229
|
-
buttons=[messages.button(edit_url, _("Edit"))],
|
|
230
|
-
)
|
|
231
|
-
return redirect(redirect_url)
|
|
232
|
-
else:
|
|
233
|
-
messages.error(request, _("The document could not be saved due to errors."))
|
|
234
|
-
else:
|
|
235
|
-
form = DocumentForm(instance=doc, user=request.user)
|
|
236
|
-
|
|
237
|
-
try:
|
|
238
|
-
local_path = doc.file.path
|
|
239
|
-
except NotImplementedError:
|
|
240
|
-
# Document is hosted externally (eg, S3)
|
|
241
|
-
local_path = None
|
|
242
|
-
|
|
243
|
-
if local_path:
|
|
244
|
-
# Give error if document file doesn't exist
|
|
245
|
-
if not os.path.isfile(local_path):
|
|
246
|
-
messages.error(
|
|
247
|
-
request,
|
|
248
|
-
_(
|
|
249
|
-
"The file could not be found. Please change the source or delete the document"
|
|
250
|
-
),
|
|
251
|
-
buttons=[
|
|
252
|
-
messages.button(
|
|
253
|
-
reverse("wagtaildocs:delete", args=(doc.id,)), _("Delete")
|
|
254
|
-
)
|
|
255
|
-
],
|
|
256
|
-
)
|
|
167
|
+
@cached_property
|
|
168
|
+
def model(self):
|
|
169
|
+
# Use a property instead of setting this as a class attribute so it is
|
|
170
|
+
# accessed at request-time, thus can be tested with override_settings
|
|
171
|
+
return get_document_model()
|
|
257
172
|
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
173
|
+
def get_form_class(self):
|
|
174
|
+
return get_document_form(self.model)
|
|
175
|
+
|
|
176
|
+
def get_form_kwargs(self):
|
|
177
|
+
kwargs = super().get_form_kwargs()
|
|
178
|
+
kwargs["user"] = self.request.user
|
|
179
|
+
return kwargs
|
|
180
|
+
|
|
181
|
+
def get_initial_form_instance(self):
|
|
182
|
+
return self.model(uploaded_by_user=self.request.user)
|
|
183
|
+
|
|
184
|
+
def get_success_message(self, instance):
|
|
185
|
+
return _("Document '%(document_title)s' added.") % {
|
|
186
|
+
"document_title": instance.title
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class EditView(generic.EditView):
|
|
191
|
+
permission_policy = permission_policy
|
|
192
|
+
pk_url_kwarg = "document_id"
|
|
193
|
+
error_message = gettext_lazy("The document could not be saved due to errors.")
|
|
194
|
+
template_name = "wagtaildocs/documents/edit.html"
|
|
195
|
+
index_url_name = "wagtaildocs:index"
|
|
196
|
+
edit_url_name = "wagtaildocs:edit"
|
|
197
|
+
delete_url_name = "wagtaildocs:delete"
|
|
198
|
+
header_icon = "doc-full-inverse"
|
|
199
|
+
context_object_name = "document"
|
|
200
|
+
_show_breadcrumbs = True
|
|
201
|
+
|
|
202
|
+
@cached_property
|
|
203
|
+
def model(self):
|
|
204
|
+
return get_document_model()
|
|
205
|
+
|
|
206
|
+
def get_form_class(self):
|
|
207
|
+
return get_document_form(self.model)
|
|
208
|
+
|
|
209
|
+
def get_object(self, queryset=None):
|
|
210
|
+
obj = super().get_object(queryset)
|
|
211
|
+
if not self.permission_policy.user_has_permission_for_instance(
|
|
212
|
+
self.request.user, self.permission_required, obj
|
|
213
|
+
):
|
|
214
|
+
raise PermissionDenied
|
|
215
|
+
return obj
|
|
216
|
+
|
|
217
|
+
def get_form_kwargs(self):
|
|
218
|
+
kwargs = super().get_form_kwargs()
|
|
219
|
+
kwargs["user"] = self.request.user
|
|
220
|
+
return kwargs
|
|
221
|
+
|
|
222
|
+
def get_success_message(self):
|
|
223
|
+
return _("Document '%(document_title)s' updated") % {
|
|
224
|
+
"document_title": self.object.title
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
@cached_property
|
|
228
|
+
def next_url(self):
|
|
229
|
+
return get_valid_next_url_from_request(self.request)
|
|
230
|
+
|
|
231
|
+
def get_success_url(self):
|
|
232
|
+
return self.next_url or super().get_success_url()
|
|
233
|
+
|
|
234
|
+
def get_delete_url(self):
|
|
235
|
+
delete_url = super().get_delete_url()
|
|
236
|
+
if self.next_url:
|
|
237
|
+
delete_url += "?" + urlencode({"next": self.next_url})
|
|
238
|
+
return delete_url
|
|
239
|
+
|
|
240
|
+
def render_to_response(self, context, **response_kwargs):
|
|
241
|
+
if self.object.is_stored_locally():
|
|
242
|
+
# Give error if document file doesn't exist
|
|
243
|
+
if not os.path.isfile(self.object.file.path):
|
|
244
|
+
messages.error(
|
|
245
|
+
self.request,
|
|
246
|
+
_(
|
|
247
|
+
"The file could not be found. Please change the source or delete the document"
|
|
248
|
+
),
|
|
249
|
+
buttons=[messages.button(self.get_delete_url(), _("Delete"))],
|
|
250
|
+
)
|
|
251
|
+
|
|
252
|
+
return super().render_to_response(context, **response_kwargs)
|
|
253
|
+
|
|
254
|
+
def get_context_data(self, **kwargs):
|
|
255
|
+
context = super().get_context_data(**kwargs)
|
|
256
|
+
context["filesize"] = self.object.get_file_size()
|
|
257
|
+
context["next"] = self.next_url
|
|
258
|
+
return context
|
|
271
259
|
|
|
272
260
|
|
|
273
261
|
class DeleteView(generic.DeleteView):
|
|
@@ -308,6 +296,8 @@ class UsageView(generic.UsageView):
|
|
|
308
296
|
permission_policy = permission_policy
|
|
309
297
|
permission_required = "change"
|
|
310
298
|
header_icon = "doc-full-inverse"
|
|
299
|
+
index_url_name = "wagtaildocs:index"
|
|
300
|
+
edit_url_name = "wagtaildocs:edit"
|
|
311
301
|
|
|
312
302
|
def user_has_permission(self, permission):
|
|
313
303
|
return self.permission_policy.user_has_permission_for_instance(
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import os.path
|
|
2
2
|
|
|
3
|
+
from django.urls import reverse
|
|
4
|
+
from django.utils.text import capfirst
|
|
5
|
+
from django.utils.translation import gettext_lazy
|
|
6
|
+
|
|
7
|
+
from wagtail.admin.views.generic.base import WagtailAdminTemplateMixin
|
|
3
8
|
from wagtail.admin.views.generic.multiple_upload import AddView as BaseAddView
|
|
4
9
|
from wagtail.admin.views.generic.multiple_upload import (
|
|
5
10
|
CreateFromUploadView as BaseCreateFromUploadView,
|
|
@@ -15,10 +20,14 @@ from ..forms import get_document_form, get_document_multi_form
|
|
|
15
20
|
from ..permissions import permission_policy
|
|
16
21
|
|
|
17
22
|
|
|
18
|
-
class AddView(BaseAddView):
|
|
23
|
+
class AddView(WagtailAdminTemplateMixin, BaseAddView):
|
|
19
24
|
permission_policy = permission_policy
|
|
20
25
|
template_name = "wagtaildocs/multiple/add.html"
|
|
26
|
+
header_icon = "doc-full-inverse"
|
|
27
|
+
page_title = gettext_lazy("Add documents")
|
|
28
|
+
_show_breadcrumbs = True
|
|
21
29
|
|
|
30
|
+
index_url_name = "wagtaildocs:index"
|
|
22
31
|
edit_object_url_name = "wagtaildocs:edit_multiple"
|
|
23
32
|
delete_object_url_name = "wagtaildocs:delete_multiple"
|
|
24
33
|
edit_object_form_prefix = "doc"
|
|
@@ -31,6 +40,15 @@ class AddView(BaseAddView):
|
|
|
31
40
|
context_upload_name = "uploaded_document"
|
|
32
41
|
context_upload_id_name = "uploaded_file_id"
|
|
33
42
|
|
|
43
|
+
def get_breadcrumbs_items(self):
|
|
44
|
+
return self.breadcrumbs_items + [
|
|
45
|
+
{
|
|
46
|
+
"url": reverse(self.index_url_name),
|
|
47
|
+
"label": capfirst(self.model._meta.verbose_name_plural),
|
|
48
|
+
},
|
|
49
|
+
{"url": "", "label": self.get_page_title()},
|
|
50
|
+
]
|
|
51
|
+
|
|
34
52
|
def get_model(self):
|
|
35
53
|
return get_document_model()
|
|
36
54
|
|
|
@@ -8,7 +8,7 @@ msgid ""
|
|
|
8
8
|
msgstr ""
|
|
9
9
|
"Project-Id-Version: PACKAGE VERSION\n"
|
|
10
10
|
"Report-Msgid-Bugs-To: \n"
|
|
11
|
-
"POT-Creation-Date: 2024-
|
|
11
|
+
"POT-Creation-Date: 2024-10-21 17:53+0100\n"
|
|
12
12
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
|
13
13
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
|
14
14
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
|
@@ -88,6 +88,14 @@ coub = {
|
|
|
88
88
|
],
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
crowdsignal = {
|
|
92
|
+
"endpoint": "https://api.crowdsignal.com/oembed",
|
|
93
|
+
"urls": [
|
|
94
|
+
r"^https?://(?:[-\w]+\.)?polldaddy\.com/.+$",
|
|
95
|
+
r"^https?://poll.fm/\d+$",
|
|
96
|
+
],
|
|
97
|
+
}
|
|
98
|
+
|
|
91
99
|
crowd_ranking = {
|
|
92
100
|
"endpoint": "http://crowdranking.com/api/oembed.{format}",
|
|
93
101
|
"urls": [
|
|
@@ -384,23 +392,6 @@ pinterest = {
|
|
|
384
392
|
}
|
|
385
393
|
|
|
386
394
|
|
|
387
|
-
polldaddy = {
|
|
388
|
-
"endpoint": "https://polldaddy.com/oembed/",
|
|
389
|
-
"urls": [
|
|
390
|
-
r"^https?://(?:[-\w]+\.)?polldaddy\.com/.+$",
|
|
391
|
-
],
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
polleverywhere = {
|
|
396
|
-
"endpoint": "https://www.polleverywhere.com/services/oembed/",
|
|
397
|
-
"urls": [
|
|
398
|
-
r"^https?://www\.polleverywhere\.com/polls/.+$",
|
|
399
|
-
r"^https?://www\.polleverywhere\.com/multiple_choice_polls/.+$",
|
|
400
|
-
r"^https?://www\.polleverywhere\.com/free_text_polls/.+$",
|
|
401
|
-
],
|
|
402
|
-
}
|
|
403
|
-
|
|
404
395
|
qik = {
|
|
405
396
|
"endpoint": "http://qik.com/api/oembed.{format}",
|
|
406
397
|
"urls": [
|
|
@@ -700,6 +691,7 @@ all_providers = [
|
|
|
700
691
|
clikthrough,
|
|
701
692
|
collegehumor,
|
|
702
693
|
coub,
|
|
694
|
+
crowdsignal,
|
|
703
695
|
crowd_ranking,
|
|
704
696
|
dailymile,
|
|
705
697
|
dailymotion,
|
|
@@ -736,8 +728,6 @@ all_providers = [
|
|
|
736
728
|
opera,
|
|
737
729
|
photobucket,
|
|
738
730
|
pinterest,
|
|
739
|
-
polldaddy,
|
|
740
|
-
polleverywhere,
|
|
741
731
|
qik,
|
|
742
732
|
rdio,
|
|
743
733
|
reddit,
|