wagtail 7.2.1__py3-none-any.whl → 7.3rc1__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 +4 -2
- wagtail/admin/action_menu.py +4 -1
- wagtail/admin/api/actions/convert_alias.py +2 -2
- wagtail/admin/api/actions/copy.py +2 -2
- wagtail/admin/api/actions/copy_for_translation.py +2 -2
- wagtail/admin/api/actions/create_alias.py +2 -2
- wagtail/admin/api/actions/delete.py +1 -1
- wagtail/admin/api/actions/move.py +1 -1
- wagtail/admin/api/actions/publish.py +2 -2
- wagtail/admin/api/actions/revert_to_page_revision.py +2 -2
- wagtail/admin/api/actions/unpublish.py +1 -1
- wagtail/admin/api/filters.py +2 -2
- wagtail/admin/compare.py +22 -0
- wagtail/admin/forms/account.py +52 -1
- wagtail/admin/forms/comments.py +53 -0
- wagtail/admin/forms/models.py +36 -0
- wagtail/admin/forms/pages.py +7 -0
- wagtail/admin/forms/workflows.py +5 -2
- wagtail/admin/icons.py +4 -3
- wagtail/admin/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/ar/LC_MESSAGES/django.po +35 -0
- wagtail/admin/locale/en/LC_MESSAGES/django.po +262 -234
- wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +72 -43
- wagtail/admin/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/it/LC_MESSAGES/django.po +566 -6
- wagtail/admin/locale/it/LC_MESSAGES/djangojs.mo +0 -0
- wagtail/admin/locale/it/LC_MESSAGES/djangojs.po +40 -2
- wagtail/admin/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/nl/LC_MESSAGES/django.po +2 -2
- wagtail/admin/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/sv/LC_MESSAGES/django.po +330 -15
- wagtail/admin/locale/sv/LC_MESSAGES/djangojs.mo +0 -0
- wagtail/admin/locale/sv/LC_MESSAGES/djangojs.po +3 -2
- wagtail/admin/panels/comment_panel.py +1 -51
- wagtail/admin/panels/title_field_panel.py +3 -1
- wagtail/admin/static/wagtailadmin/css/core.css +1 -1
- wagtail/admin/static/wagtailadmin/js/bulk-actions.js +1 -1
- wagtail/admin/static/wagtailadmin/js/comments.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js +1 -1
- wagtail/admin/static/wagtailadmin/js/core.js.LICENSE.txt +1 -1
- wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
- wagtail/admin/static/wagtailadmin/js/privacy-switch.js +1 -1
- wagtail/admin/static/wagtailadmin/js/sidebar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/blocks.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/templates/wagtailadmin/base.html +1 -1
- wagtail/admin/templates/wagtailadmin/generic/edit_partials.html +100 -0
- wagtail/admin/templates/wagtailadmin/generic/form.html +26 -5
- wagtail/admin/templates/wagtailadmin/generic/includes/_loaded_revision_inputs.html +3 -0
- wagtail/admin/templates/wagtailadmin/generic/listing_results.html +1 -17
- wagtail/admin/templates/wagtailadmin/pages/create.html +14 -4
- wagtail/admin/templates/wagtailadmin/pages/edit.html +16 -3
- wagtail/admin/templates/wagtailadmin/pages/edit_partials.html +31 -0
- wagtail/admin/templates/wagtailadmin/pages/index_results.html +1 -9
- wagtail/admin/templates/wagtailadmin/shared/autosave/indicator.html +36 -0
- wagtail/admin/templates/wagtailadmin/shared/breadcrumbs.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/editing_sessions/list.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/editing_sessions/module.html +19 -3
- wagtail/admin/templates/wagtailadmin/shared/headers/_actions.html +5 -0
- wagtail/admin/templates/wagtailadmin/shared/headers/_history_icon_link.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/headers/slim_header.html +8 -9
- wagtail/admin/templates/wagtailadmin/shared/listing/filter_partials.html +19 -0
- wagtail/admin/templates/wagtailadmin/shared/side_panel_toggle.html +3 -3
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/side_panel.html +3 -0
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/privacy.html +18 -6
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/usage.html +11 -4
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/workflow.html +22 -1
- wagtail/admin/templates/wagtailadmin/shared/side_panels/preview.html +1 -0
- wagtail/admin/templates/wagtailadmin/shared/side_panels.html +1 -2
- wagtail/admin/templates/wagtailadmin/shared/unsaved_changes_warning.html +20 -20
- wagtail/admin/templates/wagtailadmin/userbar/base.html +2 -0
- wagtail/admin/templates/wagtailadmin/userbar/item_accessibility.html +1 -1
- wagtail/admin/templatetags/wagtailadmin_tags.py +6 -14
- wagtail/admin/tests/pages/test_create_page.py +298 -1
- wagtail/admin/tests/pages/test_custom_listing.py +48 -2
- wagtail/admin/tests/pages/test_edit_page.py +721 -7
- wagtail/admin/tests/pages/test_explorer_view.py +9 -5
- wagtail/admin/tests/pages/test_page_search.py +15 -0
- wagtail/admin/tests/pages/test_revisions.py +4 -0
- wagtail/admin/tests/test_account_management.py +88 -2
- wagtail/admin/tests/test_collections_views.py +15 -15
- wagtail/admin/tests/test_compare.py +34 -0
- wagtail/admin/tests/test_editing_sessions.py +230 -8
- wagtail/admin/tests/test_forms.py +192 -1
- wagtail/admin/tests/test_icon_sprite.py +22 -2
- wagtail/admin/tests/test_page_chooser.py +13 -13
- wagtail/admin/tests/test_reports_views.py +4 -1
- wagtail/admin/tests/test_userbar.py +69 -5
- wagtail/admin/tests/test_views_generic.py +5 -5
- wagtail/admin/tests/test_workflows.py +14 -12
- wagtail/admin/tests/viewsets/test_model_viewset.py +13 -0
- wagtail/admin/ui/autosave.py +5 -0
- wagtail/admin/ui/editing_sessions.py +3 -0
- wagtail/admin/ui/side_panels.py +19 -20
- wagtail/admin/userbar.py +48 -27
- wagtail/admin/views/bulk_action/dispatcher.py +2 -2
- wagtail/admin/views/chooser.py +6 -6
- wagtail/admin/views/editing_sessions.py +20 -7
- wagtail/admin/views/generic/__init__.py +1 -0
- wagtail/admin/views/generic/chooser.py +5 -5
- wagtail/admin/views/generic/mixins.py +143 -26
- wagtail/admin/views/generic/models.py +157 -27
- wagtail/admin/views/generic/ordering.py +1 -1
- wagtail/admin/views/generic/preview.py +4 -4
- wagtail/admin/views/home.py +3 -1
- wagtail/admin/views/pages/create.py +77 -29
- wagtail/admin/views/pages/edit.py +160 -34
- wagtail/admin/views/pages/preview.py +4 -4
- wagtail/admin/views/pages/revisions.py +3 -0
- wagtail/admin/views/pages/search.py +4 -4
- wagtail/admin/views/pages/usage.py +2 -2
- wagtail/admin/views/tags.py +2 -2
- wagtail/admin/views/workflows.py +73 -54
- wagtail/admin/viewsets/model.py +34 -8
- wagtail/admin/widgets/button.py +11 -4
- wagtail/admin/widgets/chooser.py +6 -4
- wagtail/admin/widgets/slug.py +1 -1
- wagtail/api/v2/filters.py +27 -21
- wagtail/api/v2/pagination.py +4 -4
- wagtail/api/v2/views.py +7 -7
- wagtail/blocks/list_block.py +0 -8
- wagtail/blocks/migrations/migrate_operation.py +8 -1
- wagtail/blocks/stream_block.py +2 -10
- wagtail/blocks/struct_block.py +192 -12
- wagtail/compat.py +2 -2
- wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/forms/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/forms/locale/it/LC_MESSAGES/django.po +40 -2
- wagtail/contrib/frontend_cache/backends/azure.py +6 -6
- wagtail/contrib/frontend_cache/backends/cloudfront.py +2 -2
- wagtail/contrib/frontend_cache/utils.py +1 -1
- wagtail/contrib/redirects/forms.py +1 -1
- wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +14 -14
- wagtail/contrib/redirects/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/redirects/locale/it/LC_MESSAGES/django.po +15 -2
- wagtail/contrib/redirects/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/redirects/locale/sv/LC_MESSAGES/django.po +16 -3
- wagtail/contrib/redirects/middleware.py +11 -7
- wagtail/contrib/redirects/models.py +17 -1
- wagtail/contrib/redirects/tests/test_import_admin_views.py +3 -3
- wagtail/contrib/redirects/tests/test_redirects.py +56 -8
- wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +6 -6
- wagtail/contrib/search_promotions/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/search_promotions/locale/it/LC_MESSAGES/django.po +43 -2
- wagtail/contrib/search_promotions/tests.py +1 -1
- wagtail/contrib/search_promotions/views/settings.py +24 -25
- wagtail/contrib/settings/jinja2tags.py +2 -2
- wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +2 -2
- wagtail/contrib/settings/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/it/LC_MESSAGES/django.po +6 -2
- wagtail/contrib/settings/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/sv/LC_MESSAGES/django.po +3 -2
- wagtail/contrib/settings/tests/generic/test_admin.py +118 -2
- wagtail/contrib/settings/tests/site_specific/test_admin.py +78 -15
- wagtail/contrib/settings/tests/site_specific/test_model.py +2 -2
- wagtail/contrib/settings/views.py +7 -0
- wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/simple_translation/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/simple_translation/locale/it/LC_MESSAGES/django.po +5 -2
- wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +7 -7
- wagtail/contrib/styleguide/tests.py +2 -0
- wagtail/contrib/styleguide/views.py +4 -5
- wagtail/contrib/table_block/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/table_block/locale/ar/LC_MESSAGES/django.po +5 -1
- wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/table_block/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/table_block/locale/it/LC_MESSAGES/django.po +5 -2
- wagtail/contrib/typed_table_block/blocks.py +37 -0
- wagtail/contrib/typed_table_block/locale/en/LC_MESSAGES/django.po +10 -10
- wagtail/contrib/typed_table_block/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/typed_table_block/locale/sv/LC_MESSAGES/django.po +4 -3
- wagtail/contrib/typed_table_block/tests.py +108 -0
- wagtail/coreutils.py +4 -4
- wagtail/documents/__init__.py +4 -4
- wagtail/documents/locale/en/LC_MESSAGES/django.po +15 -15
- wagtail/documents/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/it/LC_MESSAGES/django.po +32 -2
- wagtail/documents/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/sv/LC_MESSAGES/django.po +32 -4
- wagtail/documents/models.py +1 -1
- wagtail/documents/tests/test_admin_views.py +19 -4
- wagtail/documents/tests/test_search.py +0 -2
- wagtail/documents/tests/test_views.py +6 -4
- wagtail/documents/views/bulk_actions/add_tags.py +1 -1
- wagtail/embeds/finders/facebook.py +3 -3
- wagtail/embeds/finders/instagram.py +3 -3
- wagtail/embeds/finders/oembed.py +7 -2
- wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/embeds/oembed_providers.py +8 -0
- wagtail/embeds/tests/test_embeds.py +35 -0
- wagtail/images/__init__.py +4 -4
- wagtail/images/admin_urls.py +3 -3
- wagtail/images/blocks.py +1 -1
- wagtail/images/formats.py +2 -2
- wagtail/images/image_operations.py +2 -2
- wagtail/images/locale/en/LC_MESSAGES/django.po +44 -40
- wagtail/images/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/it/LC_MESSAGES/django.po +50 -4
- wagtail/images/locale/nl/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/nl/LC_MESSAGES/django.po +3 -3
- wagtail/images/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/sv/LC_MESSAGES/django.po +49 -6
- wagtail/images/models.py +11 -10
- wagtail/images/templates/wagtailimages/images/index_results.html +1 -1
- wagtail/images/templates/wagtailimages/images/url_generator.html +17 -38
- wagtail/images/templates/wagtailimages/images/url_generator_output.html +28 -0
- wagtail/images/templatetags/wagtailimages_tags.py +4 -4
- wagtail/images/tests/test_admin_views.py +432 -59
- wagtail/images/tests/test_image_operations.py +2 -2
- wagtail/images/tests/test_models.py +0 -2
- wagtail/images/views/bulk_actions/add_tags.py +1 -1
- wagtail/images/views/images.py +72 -39
- wagtail/locale/en/LC_MESSAGES/django.po +103 -105
- wagtail/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/it/LC_MESSAGES/django.po +105 -2
- wagtail/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/locale/sv/LC_MESSAGES/django.po +95 -12
- wagtail/locales/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/locales/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/locales/locale/it/LC_MESSAGES/django.po +13 -2
- wagtail/locales/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/locales/locale/sv/LC_MESSAGES/django.po +4 -3
- wagtail/locales/tests.py +5 -5
- wagtail/models/i18n.py +4 -6
- wagtail/models/media.py +18 -0
- wagtail/models/pages.py +65 -11
- wagtail/models/reference_index.py +15 -0
- wagtail/models/revisions.py +40 -12
- wagtail/models/workflows.py +0 -3
- wagtail/permission_policies/base.py +2 -2
- wagtail/permission_policies/collections.py +2 -2
- wagtail/project_template/requirements.txt +2 -2
- wagtail/search/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/signal_handlers.py +1 -0
- wagtail/sites/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/sites/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/sites/locale/sv/LC_MESSAGES/django.po +3 -2
- wagtail/sites/tests.py +7 -7
- wagtail/snippets/action_menu.py +2 -1
- wagtail/snippets/locale/en/LC_MESSAGES/django.po +23 -13
- wagtail/snippets/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/snippets/locale/sv/LC_MESSAGES/django.po +12 -1
- wagtail/snippets/tests/test_chooser_block.py +197 -0
- wagtail/snippets/tests/test_chooser_panel.py +149 -0
- wagtail/snippets/tests/test_chooser_views.py +375 -0
- wagtail/snippets/tests/test_chooser_widget.py +22 -0
- wagtail/snippets/tests/test_compare_revisions_view.py +167 -0
- wagtail/snippets/tests/test_copy_view.py +38 -0
- wagtail/snippets/tests/test_create_view.py +1159 -0
- wagtail/snippets/tests/test_delete_view.py +225 -0
- wagtail/snippets/tests/test_edit_view.py +2882 -0
- wagtail/snippets/tests/test_history_view.py +182 -0
- wagtail/snippets/tests/test_index_view.py +105 -0
- wagtail/snippets/tests/test_list_view.py +786 -0
- wagtail/snippets/tests/test_locking.py +28 -0
- wagtail/snippets/tests/test_permissions.py +167 -0
- wagtail/snippets/tests/test_preview.py +3 -3
- wagtail/snippets/tests/test_revert_view.py +343 -0
- wagtail/snippets/tests/test_snippet_models.py +112 -0
- wagtail/snippets/tests/test_unpublish_view.py +228 -0
- wagtail/snippets/tests/test_unschedule_view.py +151 -0
- wagtail/snippets/tests/test_viewset.py +38 -5
- wagtail/snippets/views/snippets.py +78 -30
- wagtail/snippets/widgets.py +2 -2
- wagtail/templatetags/wagtailcore_tags.py +2 -2
- wagtail/test/dummy_external_storage.py +1 -1
- wagtail/test/testapp/fixtures/test.json +22 -0
- wagtail/test/testapp/fixtures/test_empty.json +2 -0
- wagtail/test/testapp/fixtures/test_explorable_pages.json +10 -0
- wagtail/test/testapp/fixtures/test_specific.json +9 -0
- wagtail/test/testapp/migrations/0059_nopromotepage.py +25 -0
- wagtail/test/testapp/models.py +7 -0
- wagtail/test/testapp/views.py +5 -0
- wagtail/test/utils/page_tests.py +7 -7
- wagtail/test/utils/wagtail_factories/builder.py +2 -2
- wagtail/tests/streamfield_migrations/test_migrations.py +35 -0
- wagtail/tests/test_blocks.py +321 -61
- wagtail/tests/test_collection_model.py +12 -0
- wagtail/tests/test_page_model.py +190 -1
- wagtail/tests/test_page_privacy.py +5 -0
- wagtail/tests/test_reference_index.py +42 -0
- wagtail/tests/test_revision_model.py +118 -1
- wagtail/tests/test_utils.py +2 -2
- wagtail/users/locale/en/LC_MESSAGES/django.po +14 -14
- wagtail/users/locale/id_ID/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/id_ID/LC_MESSAGES/django.po +6 -2
- wagtail/users/locale/it/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/it/LC_MESSAGES/django.po +14 -2
- wagtail/users/locale/sv/LC_MESSAGES/django.mo +0 -0
- wagtail/users/locale/sv/LC_MESSAGES/django.po +48 -17
- wagtail/users/tests/test_admin_views.py +39 -25
- wagtail/users/utils.py +4 -1
- wagtail/users/views/groups.py +19 -5
- wagtail/users/wagtail_hooks.py +1 -1
- wagtail/utils/loading.py +2 -2
- wagtail-7.3rc1.data/data/AGENTS.md +21 -0
- wagtail-7.3rc1.data/data/CHANGELOG.txt +4941 -0
- wagtail-7.3rc1.data/data/CODE_OF_CONDUCT.md +71 -0
- wagtail-7.3rc1.data/data/CONTRIBUTORS.md +999 -0
- wagtail-7.3rc1.data/data/SPONSORS.md +55 -0
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/METADATA +6 -6
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/RECORD +310 -280
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/WHEEL +1 -1
- wagtail/images/static/wagtailimages/js/image-url-generator.js +0 -1
- wagtail/snippets/tests/test_snippets.py +0 -6377
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/entry_points.txt +0 -0
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/licenses/LICENSE +0 -0
- {wagtail-7.2.1.dist-info → wagtail-7.3rc1.dist-info}/top_level.txt +0 -0
|
@@ -31,12 +31,24 @@
|
|
|
31
31
|
{{ block.super }}
|
|
32
32
|
{% endwith %}
|
|
33
33
|
</div>
|
|
34
|
-
|
|
35
|
-
{%
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
34
|
+
|
|
35
|
+
{% if is_partial and not hydrate_create_view %}
|
|
36
|
+
{% comment %}
|
|
37
|
+
The dialog will be teleported to the body. Do not re-render the dialog
|
|
38
|
+
when rendering partials, as we would end up with multiple instances.
|
|
39
|
+
However, we do want to render the dialog when hydrating the create view,
|
|
40
|
+
as in that case the initial render didn't have the page ID needed to
|
|
41
|
+
render the dialog.
|
|
42
|
+
{% endcomment %}
|
|
43
|
+
{% elif page.id %}
|
|
44
|
+
{# Only render when the page has been saved, as we need the ID for the URL #}
|
|
45
|
+
{% trans 'Change privacy' as set_privacy_title %}
|
|
46
|
+
{% trans 'Choose who can view the live version of this page' as set_privacy_message %}
|
|
47
|
+
{% trans 'Privacy changes apply to all children of this page too.' as privacy_message_text %}
|
|
48
|
+
{% url 'wagtailadmin_pages:set_privacy' page.id as privacy_url %}
|
|
49
|
+
{% dialog icon_name='view' id='set-privacy' data_url=privacy_url title=set_privacy_title subtitle=set_privacy_message message_status='warning' message_heading=privacy_message_text %}
|
|
50
|
+
{% enddialog %}
|
|
51
|
+
{% endif %}
|
|
40
52
|
{% endblock %}
|
|
41
53
|
|
|
42
54
|
{% block action %}
|
|
@@ -7,15 +7,22 @@
|
|
|
7
7
|
{% trans "Usage" %}
|
|
8
8
|
</h3>
|
|
9
9
|
</div>
|
|
10
|
-
|
|
11
|
-
href="{{ usage_url }}"
|
|
12
|
-
>
|
|
10
|
+
{% fragment as usage_label %}
|
|
13
11
|
{% if usage_url_text %}
|
|
14
12
|
{{ usage_url_text }}
|
|
15
13
|
{% else %}
|
|
16
14
|
{% blocktrans trimmed with counter=usage_count usage_count=usage_count|intcomma count counter=counter %}Used {{ usage_count }} time{% plural %}Used {{ usage_count }} times{% endblocktrans %}
|
|
17
15
|
{% endif %}
|
|
18
|
-
|
|
16
|
+
{% endfragment %}
|
|
17
|
+
{% if usage_url %}
|
|
18
|
+
<a class="w-text-14 w-text-text-link-default hover:w-text-text-link-hover w-no-underline w-transition"
|
|
19
|
+
href="{{ usage_url }}"
|
|
20
|
+
>
|
|
21
|
+
{{ usage_label }}
|
|
22
|
+
</a>
|
|
23
|
+
{% else %}
|
|
24
|
+
<span>{{ usage_label }}</span>
|
|
25
|
+
{% endif %}
|
|
19
26
|
</div>
|
|
20
27
|
</section>
|
|
21
28
|
</div>
|
|
@@ -80,6 +80,19 @@
|
|
|
80
80
|
{% endif %}
|
|
81
81
|
{% endwith %}
|
|
82
82
|
</div>
|
|
83
|
+
{% else %}
|
|
84
|
+
{% if draftstate_enabled %}
|
|
85
|
+
{% trans "Draft" as title %}
|
|
86
|
+
{% fragment as icon_name %}draft{% endfragment %}
|
|
87
|
+
{% else %}
|
|
88
|
+
{% trans "Live" as title %}
|
|
89
|
+
{% fragment as icon_name %}doc-full-inverse{% endfragment %}
|
|
90
|
+
{% endif %}
|
|
91
|
+
{% blocktranslate trimmed asvar help_text with user=request.user|user_display_name %}
|
|
92
|
+
To be created by {{ user }}
|
|
93
|
+
{% endblocktranslate %}
|
|
94
|
+
|
|
95
|
+
{{ block.super }}
|
|
83
96
|
{% endif %}
|
|
84
97
|
{% endblock %}
|
|
85
98
|
|
|
@@ -88,7 +101,15 @@
|
|
|
88
101
|
{% dialog_toggle classname='w-bg-transparent w-text-14 w-p-0 w-text-text-link-default hover:w-text-text-link-hover w-inline-flex w-justify-center w-transition' dialog_id="workflow-status-dialog" text=action_text %}
|
|
89
102
|
|
|
90
103
|
{# info subtitle #}
|
|
91
|
-
{% if
|
|
104
|
+
{% if is_partial %}
|
|
105
|
+
{% comment %}
|
|
106
|
+
The dialog will be teleported to the body. Do not re-render the dialog
|
|
107
|
+
when rendering partials, as we would end up with multiple instances.
|
|
108
|
+
We also don't render it when hydrating the create view, as it's unlikely
|
|
109
|
+
that the object immediately enters a workflow on creation without a
|
|
110
|
+
full-page reload.
|
|
111
|
+
{% endcomment %}
|
|
112
|
+
{% elif object.get_latest_revision %}
|
|
92
113
|
{% workflow_status_with_date workflow_state as message_heading %}
|
|
93
114
|
{% if workflow_state.requested_by %}
|
|
94
115
|
{% blocktrans trimmed with user=workflow_state.requested_by|user_display_name asvar modified_by %}by {{ user }}{% endblocktrans %}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<div
|
|
4
4
|
class="w-preview"
|
|
5
5
|
data-controller="w-preview"
|
|
6
|
+
data-action="w-unsaved:add@document->w-preview#setStale"
|
|
6
7
|
data-w-preview-has-errors-class="w-preview--has-errors"
|
|
7
8
|
data-w-preview-proxy-class="w-preview__proxy"
|
|
8
9
|
data-w-preview-selected-size-class="w-preview__size-button--selected"
|
|
@@ -27,8 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
{% for panel in side_panels %}
|
|
29
29
|
<div class="form-side__panel" data-side-panel="{{ panel.name }}" hidden>
|
|
30
|
-
|
|
31
|
-
{% component panel %}
|
|
30
|
+
{% include "wagtailadmin/shared/side_panels/includes/side_panel.html" with panel=panel %}
|
|
32
31
|
</div>
|
|
33
32
|
{% endfor %}
|
|
34
33
|
</aside>
|
|
@@ -3,31 +3,31 @@
|
|
|
3
3
|
class="footer__container footer__container--hidden"
|
|
4
4
|
aria-live="polite"
|
|
5
5
|
data-controller="w-messages"
|
|
6
|
-
data-action="w-unsaved:add@document->w-messages#add w-unsaved:clear@document->w-messages#clear"
|
|
6
|
+
data-action="w-unsaved:add@document->w-messages#add w-unsaved:clear@document->w-messages#clear w-autosave:error@document->w-messages#add"
|
|
7
7
|
data-w-messages-clear-delay-value="1024"
|
|
8
8
|
data-w-messages-clear-param="true"
|
|
9
9
|
data-w-messages-hide-class="footer__container--hidden"
|
|
10
10
|
>
|
|
11
11
|
<div class="footer__save-warning footer__emphasise-span-tags" data-w-messages-target="container"></div>
|
|
12
12
|
{% block message_templates %}
|
|
13
|
-
{%
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
</
|
|
31
|
-
|
|
13
|
+
{% if autosave_enabled %}
|
|
14
|
+
{% blocktranslate trimmed asvar generic_save_message %}
|
|
15
|
+
Autosave is <span>paused</span>
|
|
16
|
+
{% endblocktranslate %}
|
|
17
|
+
<template data-w-messages-target="template" data-selector="p">
|
|
18
|
+
<div>
|
|
19
|
+
<b>{{ generic_save_message }}</b>
|
|
20
|
+
<p></p>
|
|
21
|
+
</div>
|
|
22
|
+
</template>
|
|
23
|
+
{% else %}
|
|
24
|
+
{% trans 'Save your changes before leaving' as generic_save_message %}
|
|
25
|
+
<template data-w-messages-target="template" data-type="edits">
|
|
26
|
+
<div>
|
|
27
|
+
<b>{% blocktrans trimmed %}You have <span>unsaved edits</span>{% endblocktrans %}</b>
|
|
28
|
+
<p>{{ generic_save_message }}</p>
|
|
29
|
+
</div>
|
|
30
|
+
</template>
|
|
31
|
+
{% endif %}
|
|
32
32
|
{% endblock %}
|
|
33
33
|
</div>
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
<link rel="stylesheet" href="{% build_absolute_url core_css_url %}">
|
|
10
10
|
{# For headless userbar: the contents of the hook also need absolute URLs #}
|
|
11
11
|
{% hook_output 'insert_global_admin_css' %}
|
|
12
|
+
{{ media.css }}
|
|
12
13
|
{% endblock %}
|
|
13
14
|
<div class="w-userbar-nav">
|
|
14
15
|
|
|
@@ -49,5 +50,6 @@
|
|
|
49
50
|
{% versioned_static 'wagtailadmin/js/userbar.js' as userbar_js_url %}
|
|
50
51
|
<script src="{% build_absolute_url vendor_js_url %}"></script>
|
|
51
52
|
<script src="{% build_absolute_url userbar_js_url %}"></script>
|
|
53
|
+
{{ media.js }}
|
|
52
54
|
{% endblock %}
|
|
53
55
|
<!-- end Wagtail user bar embed code -->
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{% block item_content %}
|
|
5
5
|
<button type="button" id="accessibility-trigger" role="menuitem">
|
|
6
6
|
<span class="w-sr-only">{% trans 'Issues found' %}</span><span class="w-a11y-result__count" data-a11y-result-count></span>
|
|
7
|
-
{% trans '
|
|
7
|
+
{% trans 'Checks' %}
|
|
8
8
|
</button>
|
|
9
9
|
{{ axe_configuration|json_script:"accessibility-axe-configuration" }}
|
|
10
10
|
{% trans 'Warnings' as dialog_title %}
|
|
@@ -19,7 +19,6 @@ from django.utils import timezone
|
|
|
19
19
|
from django.utils.encoding import force_str
|
|
20
20
|
from django.utils.formats import get_format
|
|
21
21
|
from django.utils.html import avoid_wrapping, json_script
|
|
22
|
-
from django.utils.http import urlencode
|
|
23
22
|
from django.utils.safestring import mark_safe
|
|
24
23
|
from django.utils.timesince import timesince
|
|
25
24
|
from django.utils.translation import gettext_lazy as _
|
|
@@ -40,7 +39,6 @@ from wagtail.admin.utils import (
|
|
|
40
39
|
get_keyboard_key_labels_from_request,
|
|
41
40
|
get_latest_str,
|
|
42
41
|
get_user_display_name,
|
|
43
|
-
get_valid_next_url_from_request,
|
|
44
42
|
)
|
|
45
43
|
from wagtail.admin.views.bulk_action.registry import bulk_action_registry
|
|
46
44
|
from wagtail.admin.views.pages.utils import get_breadcrumbs_items_for_page
|
|
@@ -509,18 +507,14 @@ def bulk_action_choices(context, app_label, model_name):
|
|
|
509
507
|
bulk_action_more_list = bulk_actions_list[4:]
|
|
510
508
|
bulk_actions_list = bulk_actions_list[:4]
|
|
511
509
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
next_url = context["request"].path
|
|
515
|
-
|
|
510
|
+
# These buttons are not re-rendered after AJAX search and filters are applied,
|
|
511
|
+
# so don't include a 'next' parameter and let the JS construct it later.
|
|
516
512
|
bulk_action_buttons = [
|
|
517
513
|
ListingButton(
|
|
518
514
|
action.display_name,
|
|
519
515
|
reverse(
|
|
520
516
|
"wagtail_bulk_action", args=[app_label, model_name, action.action_type]
|
|
521
|
-
)
|
|
522
|
-
+ "?"
|
|
523
|
-
+ urlencode({"next": next_url}),
|
|
517
|
+
),
|
|
524
518
|
attrs={"aria-label": action.aria_label, "data-bulk-action-button": ""},
|
|
525
519
|
priority=action.action_priority,
|
|
526
520
|
classname=" ".join(action.classes | {"bulk-action-btn"}),
|
|
@@ -539,9 +533,7 @@ def bulk_action_choices(context, app_label, model_name):
|
|
|
539
533
|
url=reverse(
|
|
540
534
|
"wagtail_bulk_action",
|
|
541
535
|
args=[app_label, model_name, action.action_type],
|
|
542
|
-
)
|
|
543
|
-
+ "?"
|
|
544
|
-
+ urlencode({"next": next_url}),
|
|
536
|
+
),
|
|
545
537
|
attrs={
|
|
546
538
|
"aria-label": action.aria_label,
|
|
547
539
|
"data-bulk-action-button": "",
|
|
@@ -1037,9 +1029,9 @@ def fragment(parser, token):
|
|
|
1037
1029
|
tag_name, *options, target_var = token.split_contents()
|
|
1038
1030
|
nodelist = parser.parse(("endfragment",))
|
|
1039
1031
|
parser.delete_first_token()
|
|
1040
|
-
except ValueError:
|
|
1032
|
+
except ValueError as e:
|
|
1041
1033
|
if settings.DEBUG:
|
|
1042
|
-
raise template.TemplateSyntaxError(error_message)
|
|
1034
|
+
raise template.TemplateSyntaxError(error_message) from e
|
|
1043
1035
|
return ""
|
|
1044
1036
|
|
|
1045
1037
|
stripped = "stripped" in options
|
|
@@ -2,7 +2,7 @@ import datetime
|
|
|
2
2
|
from unittest import mock
|
|
3
3
|
|
|
4
4
|
from django.contrib.auth.models import Group, Permission
|
|
5
|
-
from django.http import HttpRequest, HttpResponse
|
|
5
|
+
from django.http import HttpRequest, HttpResponse, JsonResponse
|
|
6
6
|
from django.test import TestCase
|
|
7
7
|
from django.test.utils import override_settings
|
|
8
8
|
from django.urls import reverse
|
|
@@ -572,6 +572,32 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
572
572
|
# form should be marked as having unsaved changes for the purposes of the dirty-forms warning
|
|
573
573
|
self.assertContains(response, 'data-w-unsaved-force-value="true"')
|
|
574
574
|
|
|
575
|
+
def test_create_simplepage_post_invalid_with_json_response(self):
|
|
576
|
+
post_data = {
|
|
577
|
+
"title": "",
|
|
578
|
+
"content": "Some content",
|
|
579
|
+
"slug": "hello-world",
|
|
580
|
+
}
|
|
581
|
+
response = self.client.post(
|
|
582
|
+
reverse(
|
|
583
|
+
"wagtailadmin_pages:add",
|
|
584
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
585
|
+
),
|
|
586
|
+
post_data,
|
|
587
|
+
headers={"Accept": "application/json"},
|
|
588
|
+
)
|
|
589
|
+
|
|
590
|
+
self.assertEqual(response.status_code, 400)
|
|
591
|
+
self.assertEqual(response["Content-Type"], "application/json")
|
|
592
|
+
self.assertEqual(
|
|
593
|
+
response.json(),
|
|
594
|
+
{
|
|
595
|
+
"success": False,
|
|
596
|
+
"error_code": "validation_error",
|
|
597
|
+
"error_message": "There are validation errors, click save to highlight them.",
|
|
598
|
+
},
|
|
599
|
+
)
|
|
600
|
+
|
|
575
601
|
def test_create_simplepage_post_with_blank_content(self):
|
|
576
602
|
"""
|
|
577
603
|
Saving a page as draft with blank content should be allowed, as this skips
|
|
@@ -610,6 +636,53 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
610
636
|
any(Page.find_problems()), msg="treebeard found consistency problems"
|
|
611
637
|
)
|
|
612
638
|
|
|
639
|
+
def test_create_simplepage_post_with_json_response(self):
|
|
640
|
+
post_data = {
|
|
641
|
+
"title": "New page",
|
|
642
|
+
"content": "hello world",
|
|
643
|
+
"slug": "hello-world",
|
|
644
|
+
}
|
|
645
|
+
response = self.client.post(
|
|
646
|
+
reverse(
|
|
647
|
+
"wagtailadmin_pages:add",
|
|
648
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
649
|
+
),
|
|
650
|
+
post_data,
|
|
651
|
+
headers={"Accept": "application/json"},
|
|
652
|
+
)
|
|
653
|
+
# Find the page and check it
|
|
654
|
+
page = Page.objects.get(
|
|
655
|
+
path__startswith=self.root_page.path, slug="hello-world"
|
|
656
|
+
).specific
|
|
657
|
+
|
|
658
|
+
self.assertEqual(response.status_code, 200)
|
|
659
|
+
self.assertEqual(response["Content-Type"], "application/json")
|
|
660
|
+
revision = page.get_latest_revision()
|
|
661
|
+
response_json = response.json()
|
|
662
|
+
self.assertEqual(response_json["success"], True)
|
|
663
|
+
self.assertEqual(response_json["pk"], page.pk)
|
|
664
|
+
self.assertEqual(response_json["revision_id"], revision.pk)
|
|
665
|
+
self.assertEqual(
|
|
666
|
+
response_json["revision_created_at"],
|
|
667
|
+
revision.created_at.isoformat(),
|
|
668
|
+
)
|
|
669
|
+
self.assertEqual(response_json["field_updates"], {})
|
|
670
|
+
self.assertEqual(
|
|
671
|
+
response_json["url"],
|
|
672
|
+
reverse("wagtailadmin_pages:edit", args=(page.pk,)),
|
|
673
|
+
)
|
|
674
|
+
|
|
675
|
+
self.assertEqual(page.title, post_data["title"])
|
|
676
|
+
self.assertEqual(page.draft_title, post_data["title"])
|
|
677
|
+
self.assertIsInstance(page, SimplePage)
|
|
678
|
+
self.assertFalse(page.live)
|
|
679
|
+
self.assertFalse(page.first_published_at)
|
|
680
|
+
|
|
681
|
+
# treebeard should report no consistency problems with the tree
|
|
682
|
+
self.assertFalse(
|
|
683
|
+
any(Page.find_problems()), msg="treebeard found consistency problems"
|
|
684
|
+
)
|
|
685
|
+
|
|
613
686
|
def test_publish_simplepage_post_with_blank_content(self):
|
|
614
687
|
post_data = {
|
|
615
688
|
"title": "New page",
|
|
@@ -1799,6 +1872,52 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
1799
1872
|
self.assertEqual(response.status_code, 200)
|
|
1800
1873
|
self.assertEqual(response.content, b"Overridden!")
|
|
1801
1874
|
|
|
1875
|
+
def test_before_create_page_hook_with_json_response(self):
|
|
1876
|
+
def non_json_hook_func(request, parent_page, page_class):
|
|
1877
|
+
self.assertIsInstance(request, HttpRequest)
|
|
1878
|
+
self.assertEqual(parent_page.id, self.root_page.id)
|
|
1879
|
+
self.assertEqual(page_class, SimplePage)
|
|
1880
|
+
|
|
1881
|
+
return HttpResponse("Overridden!")
|
|
1882
|
+
|
|
1883
|
+
def json_hook_func(request, parent_page, page_class):
|
|
1884
|
+
self.assertIsInstance(request, HttpRequest)
|
|
1885
|
+
self.assertEqual(parent_page.id, self.root_page.id)
|
|
1886
|
+
self.assertEqual(page_class, SimplePage)
|
|
1887
|
+
|
|
1888
|
+
return JsonResponse({"status": "purple"})
|
|
1889
|
+
|
|
1890
|
+
with self.register_hook("before_create_page", non_json_hook_func):
|
|
1891
|
+
response = self.client.get(
|
|
1892
|
+
reverse(
|
|
1893
|
+
"wagtailadmin_pages:add",
|
|
1894
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
1895
|
+
),
|
|
1896
|
+
headers={"Accept": "application/json"},
|
|
1897
|
+
)
|
|
1898
|
+
|
|
1899
|
+
self.assertEqual(response.status_code, 400)
|
|
1900
|
+
self.assertEqual(
|
|
1901
|
+
response.json(),
|
|
1902
|
+
{
|
|
1903
|
+
"success": False,
|
|
1904
|
+
"error_code": "blocked_by_hook",
|
|
1905
|
+
"error_message": "Request to create page was blocked by hook.",
|
|
1906
|
+
},
|
|
1907
|
+
)
|
|
1908
|
+
|
|
1909
|
+
with self.register_hook("before_create_page", json_hook_func):
|
|
1910
|
+
response = self.client.get(
|
|
1911
|
+
reverse(
|
|
1912
|
+
"wagtailadmin_pages:add",
|
|
1913
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
1914
|
+
),
|
|
1915
|
+
headers={"Accept": "application/json"},
|
|
1916
|
+
)
|
|
1917
|
+
|
|
1918
|
+
self.assertEqual(response.status_code, 200)
|
|
1919
|
+
self.assertEqual(response.json(), {"status": "purple"})
|
|
1920
|
+
|
|
1802
1921
|
def test_before_create_page_hook_post(self):
|
|
1803
1922
|
def hook_func(request, parent_page, page_class):
|
|
1804
1923
|
self.assertIsInstance(request, HttpRequest)
|
|
@@ -1827,6 +1946,70 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
1827
1946
|
# page should not be created
|
|
1828
1947
|
self.assertFalse(Page.objects.filter(title="New page!").exists())
|
|
1829
1948
|
|
|
1949
|
+
def test_before_create_page_hook_post_with_json_response(self):
|
|
1950
|
+
def non_json_hook_func(request, parent_page, page_class):
|
|
1951
|
+
self.assertIsInstance(request, HttpRequest)
|
|
1952
|
+
self.assertEqual(parent_page.id, self.root_page.id)
|
|
1953
|
+
self.assertEqual(page_class, SimplePage)
|
|
1954
|
+
|
|
1955
|
+
return HttpResponse("Overridden!")
|
|
1956
|
+
|
|
1957
|
+
def json_hook_func(request, parent_page, page_class):
|
|
1958
|
+
self.assertIsInstance(request, HttpRequest)
|
|
1959
|
+
self.assertEqual(parent_page.id, self.root_page.id)
|
|
1960
|
+
self.assertEqual(page_class, SimplePage)
|
|
1961
|
+
|
|
1962
|
+
return JsonResponse({"status": "purple"})
|
|
1963
|
+
|
|
1964
|
+
with self.register_hook("before_create_page", non_json_hook_func):
|
|
1965
|
+
post_data = {
|
|
1966
|
+
"title": "New page!",
|
|
1967
|
+
"content": "Some content",
|
|
1968
|
+
"slug": "hello-world",
|
|
1969
|
+
}
|
|
1970
|
+
response = self.client.post(
|
|
1971
|
+
reverse(
|
|
1972
|
+
"wagtailadmin_pages:add",
|
|
1973
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
1974
|
+
),
|
|
1975
|
+
post_data,
|
|
1976
|
+
headers={"Accept": "application/json"},
|
|
1977
|
+
)
|
|
1978
|
+
|
|
1979
|
+
self.assertEqual(response.status_code, 400)
|
|
1980
|
+
self.assertEqual(
|
|
1981
|
+
response.json(),
|
|
1982
|
+
{
|
|
1983
|
+
"success": False,
|
|
1984
|
+
"error_code": "blocked_by_hook",
|
|
1985
|
+
"error_message": "Request to create page was blocked by hook.",
|
|
1986
|
+
},
|
|
1987
|
+
)
|
|
1988
|
+
|
|
1989
|
+
# page should not be created
|
|
1990
|
+
self.assertFalse(Page.objects.filter(title="New page!").exists())
|
|
1991
|
+
|
|
1992
|
+
with self.register_hook("before_create_page", json_hook_func):
|
|
1993
|
+
post_data = {
|
|
1994
|
+
"title": "New page!",
|
|
1995
|
+
"content": "Some content",
|
|
1996
|
+
"slug": "hello-world",
|
|
1997
|
+
}
|
|
1998
|
+
response = self.client.post(
|
|
1999
|
+
reverse(
|
|
2000
|
+
"wagtailadmin_pages:add",
|
|
2001
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
2002
|
+
),
|
|
2003
|
+
post_data,
|
|
2004
|
+
headers={"Accept": "application/json"},
|
|
2005
|
+
)
|
|
2006
|
+
|
|
2007
|
+
self.assertEqual(response.status_code, 200)
|
|
2008
|
+
self.assertEqual(response.json(), {"status": "purple"})
|
|
2009
|
+
|
|
2010
|
+
# page should not be created
|
|
2011
|
+
self.assertFalse(Page.objects.filter(title="New page!").exists())
|
|
2012
|
+
|
|
1830
2013
|
def test_after_create_page_hook(self):
|
|
1831
2014
|
def hook_func(request, page):
|
|
1832
2015
|
self.assertIsInstance(request, HttpRequest)
|
|
@@ -1858,6 +2041,70 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
1858
2041
|
# page should be created
|
|
1859
2042
|
self.assertTrue(Page.objects.filter(title="New page!").exists())
|
|
1860
2043
|
|
|
2044
|
+
def test_after_create_page_hook_with_json_response(self):
|
|
2045
|
+
def non_json_hook_func(request, page):
|
|
2046
|
+
self.assertIsInstance(request, HttpRequest)
|
|
2047
|
+
self.assertIsInstance(page, SimplePage)
|
|
2048
|
+
|
|
2049
|
+
# Both are None as this is only a draft
|
|
2050
|
+
self.assertIsNone(page.first_published_at)
|
|
2051
|
+
self.assertIsNone(page.last_published_at)
|
|
2052
|
+
|
|
2053
|
+
return HttpResponse("Overridden!")
|
|
2054
|
+
|
|
2055
|
+
def json_hook_func(request, page):
|
|
2056
|
+
self.assertIsInstance(request, HttpRequest)
|
|
2057
|
+
self.assertIsInstance(page, SimplePage)
|
|
2058
|
+
|
|
2059
|
+
# Both are None as this is only a draft
|
|
2060
|
+
self.assertIsNone(page.first_published_at)
|
|
2061
|
+
self.assertIsNone(page.last_published_at)
|
|
2062
|
+
|
|
2063
|
+
return JsonResponse({"status": "purple"})
|
|
2064
|
+
|
|
2065
|
+
with self.register_hook("after_create_page", non_json_hook_func):
|
|
2066
|
+
post_data = {
|
|
2067
|
+
"title": "New page!",
|
|
2068
|
+
"content": "Some content",
|
|
2069
|
+
"slug": "hello-world",
|
|
2070
|
+
}
|
|
2071
|
+
response = self.client.post(
|
|
2072
|
+
reverse(
|
|
2073
|
+
"wagtailadmin_pages:add",
|
|
2074
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
2075
|
+
),
|
|
2076
|
+
post_data,
|
|
2077
|
+
headers={"Accept": "application/json"},
|
|
2078
|
+
)
|
|
2079
|
+
|
|
2080
|
+
self.assertEqual(response.status_code, 200)
|
|
2081
|
+
# hook response is ignored, since it's not a JSON response
|
|
2082
|
+
self.assertEqual(response.json()["success"], True)
|
|
2083
|
+
|
|
2084
|
+
# page should be created
|
|
2085
|
+
self.assertTrue(Page.objects.filter(title="New page!").exists())
|
|
2086
|
+
|
|
2087
|
+
with self.register_hook("after_create_page", json_hook_func):
|
|
2088
|
+
post_data = {
|
|
2089
|
+
"title": "Another new page!",
|
|
2090
|
+
"content": "Some content",
|
|
2091
|
+
"slug": "hello-another-world",
|
|
2092
|
+
}
|
|
2093
|
+
response = self.client.post(
|
|
2094
|
+
reverse(
|
|
2095
|
+
"wagtailadmin_pages:add",
|
|
2096
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
2097
|
+
),
|
|
2098
|
+
post_data,
|
|
2099
|
+
headers={"Accept": "application/json"},
|
|
2100
|
+
)
|
|
2101
|
+
|
|
2102
|
+
self.assertEqual(response.status_code, 200)
|
|
2103
|
+
self.assertEqual(response.json(), {"status": "purple"})
|
|
2104
|
+
|
|
2105
|
+
# page should be created
|
|
2106
|
+
self.assertTrue(Page.objects.filter(title="Another new page!").exists())
|
|
2107
|
+
|
|
1861
2108
|
def test_after_create_page_hook_with_page_publish(self):
|
|
1862
2109
|
def hook_func(request, page):
|
|
1863
2110
|
self.assertIsInstance(request, HttpRequest)
|
|
@@ -2004,6 +2251,56 @@ class TestPageCreation(WagtailTestUtils, TestCase):
|
|
|
2004
2251
|
|
|
2005
2252
|
self.assertEqual(response.context["page"].locale, fr_locale)
|
|
2006
2253
|
|
|
2254
|
+
def test_create_shows_status_side_panel_skeleton(self):
|
|
2255
|
+
self.user.first_name = "Chrismansyah"
|
|
2256
|
+
self.user.last_name = "Rahadi"
|
|
2257
|
+
self.user.save()
|
|
2258
|
+
response = self.client.get(
|
|
2259
|
+
reverse(
|
|
2260
|
+
"wagtailadmin_pages:add",
|
|
2261
|
+
args=("tests", "simplepage", self.root_page.id),
|
|
2262
|
+
)
|
|
2263
|
+
)
|
|
2264
|
+
soup = self.get_soup(response.content)
|
|
2265
|
+
panel = soup.select_one('[data-side-panel="status"]')
|
|
2266
|
+
self.assertIsNotNone(panel)
|
|
2267
|
+
|
|
2268
|
+
def assert_panel_section(label_id, label_text, description):
|
|
2269
|
+
section = panel.select_one(f'[aria-labelledby="{label_id}"]')
|
|
2270
|
+
self.assertIsNotNone(section)
|
|
2271
|
+
label = section.select_one(f"#{label_id}")
|
|
2272
|
+
self.assertIsNotNone(label)
|
|
2273
|
+
self.assertEqual(label.get_text(separator="\n", strip=True), label_text)
|
|
2274
|
+
self.assertEqual(
|
|
2275
|
+
section.get_text(separator="\n", strip=True),
|
|
2276
|
+
f"{label_text}\n{description}",
|
|
2277
|
+
)
|
|
2278
|
+
|
|
2279
|
+
assert_panel_section(
|
|
2280
|
+
"status-sidebar-draft",
|
|
2281
|
+
"Draft",
|
|
2282
|
+
"To be created by Chrismansyah Rahadi",
|
|
2283
|
+
)
|
|
2284
|
+
|
|
2285
|
+
assert_panel_section(
|
|
2286
|
+
"status-sidebar-unlocked",
|
|
2287
|
+
"Locking:\nUnlocked",
|
|
2288
|
+
"Anyone can edit this page",
|
|
2289
|
+
)
|
|
2290
|
+
|
|
2291
|
+
assert_panel_section(
|
|
2292
|
+
"status-sidebar-visible-to-all",
|
|
2293
|
+
"Page visibility:\nVisible to all",
|
|
2294
|
+
"Once live anyone can view",
|
|
2295
|
+
)
|
|
2296
|
+
|
|
2297
|
+
usage_section = panel.select("section")[-1]
|
|
2298
|
+
self.assertIsNotNone(usage_section)
|
|
2299
|
+
self.assertEqual(
|
|
2300
|
+
usage_section.get_text(separator="\n", strip=True),
|
|
2301
|
+
"Usage\nReferenced 0 times",
|
|
2302
|
+
)
|
|
2303
|
+
|
|
2007
2304
|
|
|
2008
2305
|
class TestPermissionedFieldPanels(WagtailTestUtils, TestCase):
|
|
2009
2306
|
fixtures = ["test.json"]
|