wagtail 6.3.2__py3-none-any.whl → 6.4rc1__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/publish_revision.py +4 -5
- wagtail/admin/auth.py +0 -2
- wagtail/admin/checks.py +1 -1
- wagtail/admin/filters.py +3 -1
- wagtail/admin/forms/account.py +21 -11
- wagtail/admin/forms/collections.py +2 -9
- wagtail/admin/forms/formsets.py +32 -0
- wagtail/admin/forms/pages.py +5 -1
- wagtail/admin/forms/workflows.py +2 -13
- wagtail/admin/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/ar/LC_MESSAGES/django.po +68 -1
- wagtail/admin/locale/ar/LC_MESSAGES/djangojs.mo +0 -0
- wagtail/admin/locale/ar/LC_MESSAGES/djangojs.po +5 -1
- wagtail/admin/locale/en/LC_MESSAGES/django.po +312 -356
- wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +21 -16
- wagtail/admin/menu.py +0 -13
- wagtail/admin/panels/base.py +2 -2
- wagtail/admin/panels/group.py +4 -1
- wagtail/admin/panels/inline_panel.py +5 -2
- wagtail/admin/panels/model_utils.py +36 -0
- wagtail/admin/panels/page_utils.py +2 -40
- wagtail/admin/panels/signal_handlers.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/css/panels/streamfield.css +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 -8
- wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
- wagtail/admin/static/wagtailadmin/js/modal-workflow.js +1 -1
- wagtail/admin/static/wagtailadmin/js/page-chooser-modal.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/vendor.js.LICENSE.txt +7 -0
- wagtail/admin/templates/wagtailadmin/404.html +4 -0
- wagtail/admin/templates/wagtailadmin/chooser/browse.html +2 -1
- wagtail/admin/templates/wagtailadmin/chooser/tables/parent_page_cell.html +1 -1
- wagtail/admin/templates/wagtailadmin/collections/_privacy_switch.html +8 -1
- wagtail/admin/templates/wagtailadmin/generic/confirm_delete.html +15 -9
- wagtail/admin/templates/wagtailadmin/generic/confirm_unpublish.html +21 -25
- wagtail/admin/templates/wagtailadmin/generic/form.html +1 -1
- wagtail/admin/templates/wagtailadmin/generic/preview_error.html +3 -0
- wagtail/admin/templates/wagtailadmin/generic/revisions/compare.html +63 -76
- wagtail/admin/templates/wagtailadmin/pages/_editor_js.html +0 -2
- wagtail/admin/templates/wagtailadmin/pages/edit.html +1 -5
- wagtail/admin/templates/wagtailadmin/panels/inline_panel_child.html +1 -0
- wagtail/admin/templates/wagtailadmin/permissions/includes/collection_member_permissions_form.html +1 -1
- wagtail/admin/templates/wagtailadmin/permissions/includes/collection_member_permissions_formset.html +6 -22
- wagtail/admin/templates/wagtailadmin/shared/formatted_field.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/header.html +2 -2
- wagtail/admin/templates/wagtailadmin/shared/page_status_tag_new.html +32 -39
- wagtail/admin/templates/wagtailadmin/shared/revisions/confirm_unschedule.html +13 -17
- wagtail/admin/templates/wagtailadmin/shared/side_panels/includes/status/privacy.html +15 -3
- wagtail/admin/templates/wagtailadmin/shared/side_panels/preview.html +1 -1
- wagtail/admin/templates/wagtailadmin/skeleton.html +4 -2
- wagtail/admin/templates/wagtailadmin/workflows/create.html +1 -1
- wagtail/admin/templates/wagtailadmin/workflows/edit.html +1 -1
- wagtail/admin/templates/wagtailadmin/workflows/includes/workflow_pages_form.html +1 -1
- wagtail/admin/templates/wagtailadmin/workflows/includes/workflow_pages_formset.html +6 -23
- wagtail/admin/templatetags/wagtailadmin_tags.py +12 -0
- wagtail/admin/templatetags/wagtailuserbar.py +2 -3
- wagtail/admin/tests/pages/test_create_page.py +110 -1
- wagtail/admin/tests/pages/test_edit_page.py +3 -2
- wagtail/admin/tests/pages/test_explorer_view.py +18 -0
- wagtail/admin/tests/pages/test_page_usage.py +24 -20
- wagtail/admin/tests/pages/test_preview.py +69 -1
- wagtail/admin/tests/pages/test_revisions.py +40 -6
- wagtail/admin/tests/test_account_management.py +39 -1
- wagtail/admin/tests/test_audit_log.py +4 -2
- wagtail/admin/tests/test_block_preview.py +224 -0
- wagtail/admin/tests/test_edit_handlers.py +23 -6
- wagtail/admin/tests/test_page_chooser.py +50 -3
- wagtail/admin/tests/test_privacy.py +49 -26
- wagtail/admin/tests/test_site_summary.py +15 -10
- wagtail/admin/tests/test_templatetags.py +19 -0
- wagtail/admin/tests/test_userbar.py +82 -1
- wagtail/admin/tests/test_views_generic.py +27 -12
- wagtail/admin/tests/test_workflows.py +69 -0
- wagtail/admin/tests/tests.py +23 -4
- wagtail/admin/tests/ui/test_sidebar.py +1 -1
- wagtail/admin/tests/viewsets/test_model_viewset.py +15 -13
- wagtail/admin/ui/side_panels.py +7 -4
- wagtail/admin/urls/__init__.py +6 -0
- wagtail/admin/urls/pages.py +1 -1
- wagtail/admin/userbar.py +21 -1
- wagtail/admin/views/account.py +5 -0
- wagtail/admin/views/chooser.py +5 -1
- wagtail/admin/views/collections.py +0 -2
- wagtail/admin/views/generic/base.py +20 -10
- wagtail/admin/views/generic/history.py +0 -1
- wagtail/admin/views/generic/models.py +79 -21
- wagtail/admin/views/generic/preview.py +50 -1
- wagtail/admin/views/mixins.py +4 -2
- wagtail/admin/views/pages/bulk_actions/delete.py +11 -23
- wagtail/admin/views/pages/bulk_actions/page_bulk_action.py +17 -0
- wagtail/admin/views/pages/bulk_actions/publish.py +11 -31
- wagtail/admin/views/pages/bulk_actions/unpublish.py +11 -31
- wagtail/admin/views/pages/create.py +1 -0
- wagtail/admin/views/pages/edit.py +38 -30
- wagtail/admin/views/pages/revisions.py +43 -114
- wagtail/admin/views/pages/utils.py +0 -1
- wagtail/admin/views/tags.py +6 -2
- wagtail/admin/views/workflows.py +8 -6
- wagtail/admin/viewsets/model.py +0 -4
- wagtail/admin/viewsets/pages.py +0 -1
- wagtail/admin/widgets/tags.py +1 -0
- wagtail/api/v2/tests/test_documents.py +4 -2
- wagtail/api/v2/tests/test_images.py +4 -2
- wagtail/api/v2/tests/test_pages.py +8 -4
- wagtail/blocks/base.py +59 -1
- wagtail/blocks/field_block.py +6 -0
- wagtail/blocks/list_block.py +4 -0
- wagtail/blocks/static_block.py +3 -0
- wagtail/blocks/stream_block.py +5 -1
- wagtail/blocks/struct_block.py +6 -0
- wagtail/compat.py +16 -0
- wagtail/contrib/forms/forms.py +27 -7
- wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +2 -2
- wagtail/contrib/forms/tests/test_models.py +7 -5
- wagtail/contrib/forms/tests/test_views.py +75 -0
- wagtail/contrib/frontend_cache/tasks.py +83 -0
- wagtail/contrib/frontend_cache/tests.py +47 -32
- wagtail/contrib/frontend_cache/utils.py +2 -70
- wagtail/contrib/redirects/base_formats.py +2 -2
- wagtail/contrib/redirects/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/redirects/locale/ar/LC_MESSAGES/django.po +3 -0
- wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +24 -37
- wagtail/contrib/redirects/templates/wagtailredirects/add.html +1 -24
- wagtail/contrib/redirects/templates/wagtailredirects/confirm_delete.html +3 -13
- wagtail/contrib/redirects/tests/test_redirects.py +122 -110
- wagtail/contrib/redirects/tests/test_signal_handlers.py +75 -69
- wagtail/contrib/redirects/urls.py +2 -2
- wagtail/contrib/redirects/views.py +35 -73
- wagtail/contrib/search_promotions/admin_urls.py +10 -3
- wagtail/contrib/search_promotions/forms.py +55 -26
- wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +44 -54
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/add.html +21 -31
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/confirm_delete.html +3 -12
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/edit.html +11 -34
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotion_form.html +1 -0
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/includes/searchpromotions_formset.js +2 -1
- wagtail/contrib/search_promotions/templates/wagtailsearchpromotions/index.html +0 -1
- wagtail/contrib/search_promotions/tests.py +814 -13
- wagtail/contrib/search_promotions/views/__init__.py +1 -0
- wagtail/contrib/search_promotions/views/reports.py +56 -0
- wagtail/contrib/search_promotions/views/settings.py +258 -0
- wagtail/contrib/search_promotions/wagtail_hooks.py +12 -1
- wagtail/contrib/settings/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/contrib/settings/locale/ar/LC_MESSAGES/django.po +6 -1
- wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +3 -3
- wagtail/contrib/settings/templates/wagtailsettings/edit.html +1 -5
- wagtail/contrib/settings/tests/generic/test_admin.py +2 -5
- wagtail/contrib/settings/tests/generic/test_register.py +1 -1
- wagtail/contrib/settings/tests/site_specific/test_admin.py +2 -5
- wagtail/contrib/settings/tests/site_specific/test_register.py +1 -1
- wagtail/contrib/settings/views.py +9 -23
- wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/table_block/tests.py +4 -1
- wagtail/contrib/typed_table_block/blocks.py +3 -0
- wagtail/contrib/typed_table_block/locale/en/LC_MESSAGES/django.po +10 -10
- wagtail/contrib/typed_table_block/static/typed_table_block/js/typed_table_block.js +1 -1
- wagtail/contrib/typed_table_block/tests.py +33 -0
- wagtail/documents/locale/en/LC_MESSAGES/django.po +26 -26
- wagtail/documents/migrations/0011_add_choose_permissions.py +1 -0
- wagtail/documents/models.py +1 -0
- wagtail/documents/signal_handlers.py +6 -2
- wagtail/documents/static/wagtaildocs/js/add-multiple.js +1 -1
- wagtail/documents/templates/wagtaildocs/documents/edit.html +1 -3
- wagtail/documents/templates/wagtaildocs/multiple/add.html +7 -1
- wagtail/documents/tests/test_admin_views.py +74 -33
- wagtail/documents/tests/test_views.py +21 -12
- wagtail/documents/views/chooser.py +1 -0
- wagtail/documents/views/documents.py +1 -2
- wagtail/documents/views/multiple.py +0 -1
- wagtail/documents/views/serve.py +9 -2
- wagtail/documents/wagtail_hooks.py +6 -1
- wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/embeds/oembed_providers.py +0 -64
- wagtail/fields.py +3 -0
- wagtail/images/apps.py +2 -1
- wagtail/images/blocks.py +6 -2
- wagtail/images/forms.py +40 -3
- wagtail/images/locale/ar/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/ar/LC_MESSAGES/django.po +4 -0
- wagtail/images/locale/en/LC_MESSAGES/django.po +49 -49
- wagtail/images/migrations/0023_add_choose_permissions.py +1 -0
- wagtail/images/rich_text/contentstate.py +1 -0
- wagtail/images/rich_text/editor_html.py +1 -0
- wagtail/images/signal_handlers.py +17 -10
- wagtail/images/static/wagtailimages/js/add-multiple.js +1 -1
- wagtail/images/static/wagtailimages/js/image-block.js +1 -1
- wagtail/images/static/wagtailimages/js/image-chooser-telepath.js +1 -1
- wagtail/images/static/wagtailimages/js/image-chooser.js +1 -1
- wagtail/images/static/wagtailimages/js/image-url-generator.js +1 -1
- wagtail/images/static/wagtailimages/js/vendor/jquery.fileupload-image.js +1 -1
- wagtail/images/tasks.py +18 -0
- wagtail/images/templates/wagtailimages/images/edit.html +1 -3
- wagtail/images/templates/wagtailimages/images/url_generator.html +1 -1
- wagtail/images/templates/wagtailimages/multiple/add.html +7 -2
- wagtail/images/templates/wagtailimages/widgets/image_chooser.html +1 -1
- wagtail/images/tests/test_admin_views.py +53 -29
- wagtail/images/tests/test_blocks.py +3 -2
- wagtail/images/tests/test_models.py +12 -10
- wagtail/images/tests/tests.py +10 -0
- wagtail/images/views/chooser.py +1 -0
- wagtail/images/views/images.py +1 -3
- wagtail/images/views/multiple.py +0 -1
- wagtail/images/views/serve.py +18 -2
- wagtail/images/widgets.py +3 -0
- wagtail/locale/en/LC_MESSAGES/django.po +228 -216
- wagtail/locales/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/management/commands/publish_scheduled.py +1 -1
- wagtail/migrations/0087_alter_grouppagepermission_unique_together_and_more.py +16 -8
- wagtail/models/__init__.py +300 -119
- wagtail/models/i18n.py +2 -2
- wagtail/models/panels.py +37 -0
- wagtail/models/sites.py +7 -6
- wagtail/permission_policies/pages.py +2 -2
- wagtail/project_template/project_name/settings/base.py +4 -0
- wagtail/project_template/requirements.txt +1 -1
- wagtail/query.py +145 -0
- wagtail/search/backends/database/mysql/mysql.py +25 -17
- wagtail/search/backends/database/postgres/postgres.py +44 -83
- wagtail/search/backends/database/sqlite/sqlite.py +25 -17
- wagtail/search/backends/elasticsearch7.py +4 -0
- wagtail/search/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/search/query.py +8 -2
- wagtail/search/signal_handlers.py +6 -9
- wagtail/search/tasks.py +10 -0
- wagtail/search/tests/test_elasticsearch7_backend.py +21 -0
- wagtail/search/tests/test_index_functions.py +10 -6
- wagtail/search/tests/test_postgres_backend.py +0 -14
- wagtail/signal_handlers.py +5 -20
- wagtail/sites/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/snippets/locale/en/LC_MESSAGES/django.po +3 -13
- wagtail/snippets/tests/test_preview.py +5 -0
- wagtail/snippets/tests/test_snippets.py +100 -45
- wagtail/snippets/tests/test_usage.py +29 -24
- wagtail/snippets/tests/test_viewset.py +1 -1
- wagtail/snippets/views/snippets.py +0 -12
- wagtail/tasks.py +41 -0
- wagtail/templates/wagtailcore/shared/block_preview.html +29 -0
- wagtail/test/earlypage/__init__.py +0 -0
- wagtail/test/earlypage/migrations/0001_initial.py +37 -0
- wagtail/test/earlypage/migrations/__init__.py +0 -0
- wagtail/test/earlypage/models.py +14 -0
- wagtail/test/settings.py +3 -0
- wagtail/test/testapp/fixtures/test.json +7 -0
- wagtail/test/testapp/fixtures/test_specific.json +6 -3
- wagtail/test/testapp/models.py +58 -44
- wagtail/test/testapp/templates/tests/custom_block_preview.html +16 -0
- wagtail/test/testapp/templates/tests/static_block_preview.html +5 -0
- wagtail/test/testapp/wagtail_hooks.py +9 -0
- wagtail/tests/test_blocks.py +189 -2
- wagtail/tests/test_hooks.py +166 -1
- wagtail/tests/test_management_commands.py +54 -13
- wagtail/tests/test_page_allowed_http_methods.py +32 -0
- wagtail/tests/test_page_model.py +68 -0
- wagtail/tests/test_page_privacy.py +10 -0
- wagtail/tests/test_page_queryset.py +79 -0
- wagtail/tests/test_reference_index.py +84 -75
- wagtail/tests/test_streamfield.py +30 -0
- wagtail/tests/test_utils.py +61 -0
- wagtail/users/forms.py +2 -9
- wagtail/users/locale/en/LC_MESSAGES/django.po +17 -17
- wagtail/users/templates/wagtailusers/groups/create.html +0 -5
- wagtail/users/templates/wagtailusers/groups/includes/page_permissions_form.html +1 -1
- wagtail/users/templates/wagtailusers/groups/includes/page_permissions_formset.html +6 -6
- wagtail/users/tests/test_admin_views.py +96 -4
- wagtail/users/tests/test_utils.py +76 -0
- wagtail/users/utils.py +43 -11
- wagtail/utils/setup.py +2 -2
- wagtail/utils/templates.py +26 -0
- wagtail/utils/widgets.py +1 -0
- wagtail/views.py +9 -1
- wagtail/wagtail_hooks.py +67 -29
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/METADATA +2 -2
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/RECORD +289 -276
- wagtail/admin/static/wagtailadmin/js/expanding-formset.js +0 -1
- wagtail/admin/static/wagtailadmin/js/vendor/rangy-core.js +0 -1
- wagtail/admin/static/wagtailadmin/js/vendor/uuidv4.min.js +0 -1
- wagtail/contrib/search_promotions/views.py +0 -323
- wagtail/images/static/wagtailimages/js/vendor/canvas-to-blob.min.js +0 -1
- wagtail/users/static/wagtailusers/js/group-form.js +0 -1
- wagtail/users/templates/wagtailusers/groups/includes/group_form_js.html +0 -3
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/LICENSE +0 -0
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/WHEEL +0 -0
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/entry_points.txt +0 -0
- {wagtail-6.3.2.dist-info → wagtail-6.4rc1.dist-info}/top_level.txt +0 -0
|
@@ -1,16 +1,6 @@
|
|
|
1
|
-
{% extends "wagtailadmin/
|
|
1
|
+
{% extends "wagtailadmin/generic/confirm_delete.html" %}
|
|
2
2
|
{% load i18n %}
|
|
3
3
|
{% block titletag %}{% blocktrans trimmed with title=redirect.title %}Delete redirect {{ title }}{% endblocktrans %}{% endblock %}
|
|
4
|
-
{% block
|
|
5
|
-
{% trans "
|
|
6
|
-
{% include "wagtailadmin/shared/header.html" with title=delete_str subtitle=redirect.title icon="redirect" %}
|
|
7
|
-
|
|
8
|
-
<div class="row row-flush nice-padding">
|
|
9
|
-
<p>{% trans "Are you sure you want to delete this redirect?" %}</p>
|
|
10
|
-
<form action="{% url 'wagtailredirects:delete' redirect.id %}" method="POST">
|
|
11
|
-
{% csrf_token %}
|
|
12
|
-
<input type="submit" value="{% trans 'Yes, delete' %}" class="button serious" />
|
|
13
|
-
</form>
|
|
14
|
-
</div>
|
|
15
|
-
|
|
4
|
+
{% block confirmation_message %}
|
|
5
|
+
<p>{% trans "Are you sure you want to delete this redirect?" %}</p>
|
|
16
6
|
{% endblock %}
|
|
@@ -801,14 +801,15 @@ class TestRedirectsAddView(WagtailTestUtils, TestCase):
|
|
|
801
801
|
self.assertTemplateUsed(response, "wagtailredirects/add.html")
|
|
802
802
|
|
|
803
803
|
def test_add(self):
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
804
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
805
|
+
response = self.post(
|
|
806
|
+
{
|
|
807
|
+
"old_path": "/test",
|
|
808
|
+
"site": "",
|
|
809
|
+
"is_permanent": "on",
|
|
810
|
+
"redirect_link": "http://www.test.com/",
|
|
811
|
+
}
|
|
812
|
+
)
|
|
812
813
|
|
|
813
814
|
# Should redirect back to index
|
|
814
815
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -827,15 +828,16 @@ class TestRedirectsAddView(WagtailTestUtils, TestCase):
|
|
|
827
828
|
self.assertEqual(PURGED_URLS, {"http://localhost/test"})
|
|
828
829
|
|
|
829
830
|
def test_add_with_site(self):
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
831
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
832
|
+
localhost = Site.objects.get(hostname="localhost")
|
|
833
|
+
response = self.post(
|
|
834
|
+
{
|
|
835
|
+
"old_path": "/test",
|
|
836
|
+
"site": localhost.id,
|
|
837
|
+
"is_permanent": "on",
|
|
838
|
+
"redirect_link": "http://www.test.com/",
|
|
839
|
+
}
|
|
840
|
+
)
|
|
839
841
|
|
|
840
842
|
# Should redirect back to index
|
|
841
843
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -849,72 +851,76 @@ class TestRedirectsAddView(WagtailTestUtils, TestCase):
|
|
|
849
851
|
self.assertEqual(PURGED_URLS, {"http://localhost/test"})
|
|
850
852
|
|
|
851
853
|
def test_add_validation_error(self):
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
854
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
855
|
+
response = self.post(
|
|
856
|
+
{
|
|
857
|
+
"old_path": "",
|
|
858
|
+
"site": "",
|
|
859
|
+
"is_permanent": "on",
|
|
860
|
+
"redirect_link": "http://www.test.com/",
|
|
861
|
+
}
|
|
862
|
+
)
|
|
860
863
|
|
|
861
864
|
# Should not redirect to index
|
|
862
865
|
self.assertEqual(response.status_code, 200)
|
|
863
866
|
self.assertEqual(PURGED_URLS, set())
|
|
864
867
|
|
|
865
868
|
def test_cannot_add_duplicate_with_no_site(self):
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
869
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
870
|
+
models.Redirect.objects.create(
|
|
871
|
+
old_path="/test", site=None, redirect_link="http://elsewhere.com/"
|
|
872
|
+
)
|
|
873
|
+
response = self.post(
|
|
874
|
+
{
|
|
875
|
+
"old_path": "/test",
|
|
876
|
+
"site": "",
|
|
877
|
+
"is_permanent": "on",
|
|
878
|
+
"redirect_link": "http://www.test.com/",
|
|
879
|
+
}
|
|
880
|
+
)
|
|
877
881
|
|
|
878
882
|
# Should not redirect to index
|
|
879
883
|
self.assertEqual(response.status_code, 200)
|
|
880
884
|
self.assertEqual(PURGED_URLS, set())
|
|
881
885
|
|
|
882
886
|
def test_cannot_add_duplicate_on_same_site(self):
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
887
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
888
|
+
localhost = Site.objects.get(hostname="localhost")
|
|
889
|
+
models.Redirect.objects.create(
|
|
890
|
+
old_path="/test", site=localhost, redirect_link="http://elsewhere.com/"
|
|
891
|
+
)
|
|
892
|
+
response = self.post(
|
|
893
|
+
{
|
|
894
|
+
"old_path": "/test",
|
|
895
|
+
"site": localhost.pk,
|
|
896
|
+
"is_permanent": "on",
|
|
897
|
+
"redirect_link": "http://www.test.com/",
|
|
898
|
+
}
|
|
899
|
+
)
|
|
895
900
|
|
|
896
901
|
# Should not redirect to index
|
|
897
902
|
self.assertEqual(response.status_code, 200)
|
|
898
903
|
self.assertEqual(PURGED_URLS, set())
|
|
899
904
|
|
|
900
905
|
def test_can_reuse_path_on_other_site(self):
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
907
|
+
localhost = Site.objects.get(hostname="localhost")
|
|
908
|
+
contact_page = Page.objects.get(url_path="/home/contact-us/")
|
|
909
|
+
other_site = Site.objects.create(
|
|
910
|
+
hostname="other.example.com", port=80, root_page=contact_page
|
|
911
|
+
)
|
|
906
912
|
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
913
|
+
models.Redirect.objects.create(
|
|
914
|
+
old_path="/test", site=localhost, redirect_link="http://elsewhere.com/"
|
|
915
|
+
)
|
|
916
|
+
response = self.post(
|
|
917
|
+
{
|
|
918
|
+
"old_path": "/test",
|
|
919
|
+
"site": other_site.pk,
|
|
920
|
+
"is_permanent": "on",
|
|
921
|
+
"redirect_link": "http://www.test.com/",
|
|
922
|
+
}
|
|
923
|
+
)
|
|
918
924
|
|
|
919
925
|
# Should redirect back to index
|
|
920
926
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -926,14 +932,15 @@ class TestRedirectsAddView(WagtailTestUtils, TestCase):
|
|
|
926
932
|
self.assertEqual(PURGED_URLS, redirects.get().old_links())
|
|
927
933
|
|
|
928
934
|
def test_add_long_redirect(self):
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
935
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
936
|
+
response = self.post(
|
|
937
|
+
{
|
|
938
|
+
"old_path": "/test",
|
|
939
|
+
"site": "",
|
|
940
|
+
"is_permanent": "on",
|
|
941
|
+
"redirect_link": "https://www.google.com/search?q=this+is+a+very+long+url+because+it+has+a+huge+search+term+appended+to+the+end+of+it+even+though+someone+should+really+not+be+doing+something+so+crazy+without+first+seeing+a+psychiatrist",
|
|
942
|
+
}
|
|
943
|
+
)
|
|
937
944
|
|
|
938
945
|
# Should redirect back to index
|
|
939
946
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -1002,14 +1009,15 @@ class TestRedirectsEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
|
1002
1009
|
self.assertEqual(self.get(redirect_id=100000).status_code, 404)
|
|
1003
1010
|
|
|
1004
1011
|
def test_edit(self):
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1012
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
1013
|
+
response = self.post(
|
|
1014
|
+
{
|
|
1015
|
+
"old_path": "/test",
|
|
1016
|
+
"is_permanent": "on",
|
|
1017
|
+
"site": "",
|
|
1018
|
+
"redirect_link": "http://www.test.com/ive-been-edited",
|
|
1019
|
+
}
|
|
1020
|
+
)
|
|
1013
1021
|
|
|
1014
1022
|
# Should redirect back to index
|
|
1015
1023
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -1025,16 +1033,17 @@ class TestRedirectsEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
|
1025
1033
|
self.assertEqual(PURGED_URLS, {"http://localhost/test"})
|
|
1026
1034
|
|
|
1027
1035
|
def test_edit_with_site(self):
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1036
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
1037
|
+
localhost = Site.objects.get(hostname="localhost")
|
|
1038
|
+
|
|
1039
|
+
response = self.post(
|
|
1040
|
+
{
|
|
1041
|
+
"old_path": "/test",
|
|
1042
|
+
"is_permanent": "on",
|
|
1043
|
+
"site": localhost.id,
|
|
1044
|
+
"redirect_link": "http://www.test.com/ive-been-edited",
|
|
1045
|
+
}
|
|
1046
|
+
)
|
|
1038
1047
|
|
|
1039
1048
|
# Should redirect back to index
|
|
1040
1049
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -1049,31 +1058,33 @@ class TestRedirectsEditView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
|
1049
1058
|
self.assertEqual(PURGED_URLS, {"http://localhost/test"})
|
|
1050
1059
|
|
|
1051
1060
|
def test_edit_validation_error(self):
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1061
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
1062
|
+
response = self.post(
|
|
1063
|
+
{
|
|
1064
|
+
"old_path": "",
|
|
1065
|
+
"is_permanent": "on",
|
|
1066
|
+
"site": "",
|
|
1067
|
+
"redirect_link": "http://www.test.com/ive-been-edited",
|
|
1068
|
+
}
|
|
1069
|
+
)
|
|
1060
1070
|
|
|
1061
1071
|
# Should not redirect to index
|
|
1062
1072
|
self.assertEqual(response.status_code, 200)
|
|
1063
1073
|
self.assertEqual(PURGED_URLS, set())
|
|
1064
1074
|
|
|
1065
1075
|
def test_edit_duplicate(self):
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1076
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
1077
|
+
models.Redirect.objects.create(
|
|
1078
|
+
old_path="/othertest", site=None, redirect_link="http://elsewhere.com/"
|
|
1079
|
+
)
|
|
1080
|
+
response = self.post(
|
|
1081
|
+
{
|
|
1082
|
+
"old_path": "/othertest",
|
|
1083
|
+
"is_permanent": "on",
|
|
1084
|
+
"site": "",
|
|
1085
|
+
"redirect_link": "http://www.test.com/ive-been-edited",
|
|
1086
|
+
}
|
|
1087
|
+
)
|
|
1077
1088
|
|
|
1078
1089
|
# Should not redirect to index
|
|
1079
1090
|
self.assertEqual(response.status_code, 200)
|
|
@@ -1153,7 +1164,8 @@ class TestRedirectsDeleteView(WagtailTestUtils, TestCase):
|
|
|
1153
1164
|
self.assertEqual(self.get(redirect_id=100000).status_code, 404)
|
|
1154
1165
|
|
|
1155
1166
|
def test_delete(self):
|
|
1156
|
-
|
|
1167
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
1168
|
+
response = self.post()
|
|
1157
1169
|
|
|
1158
1170
|
# Should redirect back to index
|
|
1159
1171
|
self.assertRedirects(response, reverse("wagtailredirects:index"))
|
|
@@ -41,28 +41,29 @@ class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
|
|
41
41
|
page.save(log_action="wagtail.publish", user=self.user, clean=False)
|
|
42
42
|
|
|
43
43
|
def test_golden_path(self):
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
44
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
45
|
+
# the page we'll be triggering the change for here is...
|
|
46
|
+
test_subject = self.event_index
|
|
47
|
+
|
|
48
|
+
# identify 'draft' pages in this section
|
|
49
|
+
drafts = test_subject.get_descendants().not_live()
|
|
50
|
+
self.assertEqual(len(drafts), 4)
|
|
51
|
+
|
|
52
|
+
# gather urls for 'live' pages in this branch
|
|
53
|
+
request = get_dummy_request()
|
|
54
|
+
branch_urls = []
|
|
55
|
+
for page in (
|
|
56
|
+
test_subject.get_descendants(inclusive=True)
|
|
57
|
+
.live()
|
|
58
|
+
.specific(defer=True)
|
|
59
|
+
.iterator()
|
|
60
|
+
):
|
|
61
|
+
main_url = page.get_url(request).rstrip("/")
|
|
62
|
+
branch_urls.extend(
|
|
63
|
+
main_url + path.rstrip("/") for path in page.get_cached_paths()
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
self.trigger_page_slug_changed_signal(test_subject)
|
|
66
67
|
|
|
67
68
|
# gather all of the redirects that were created
|
|
68
69
|
redirects = Redirect.objects.all()
|
|
@@ -97,32 +98,34 @@ class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
|
|
97
98
|
)
|
|
98
99
|
|
|
99
100
|
def test_no_redirects_created_when_page_is_root_for_all_sites_it_belongs_to(self):
|
|
100
|
-
self.
|
|
101
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
102
|
+
self.trigger_page_slug_changed_signal(self.home_page)
|
|
101
103
|
self.assertFalse(Redirect.objects.exists())
|
|
102
104
|
self.assertEqual(len(PURGED_URLS), 0)
|
|
103
105
|
|
|
104
106
|
def test_handling_of_existing_redirects(self):
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
107
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
108
|
+
# the page we'll be triggering the change for here is...
|
|
109
|
+
test_subject = self.event_index
|
|
110
|
+
|
|
111
|
+
descendants = test_subject.get_descendants().live()
|
|
112
|
+
|
|
113
|
+
# but before we do, let's add some redirects that we'll expect to conflict
|
|
114
|
+
# with ones created by the signal handler
|
|
115
|
+
redirect1 = Redirect.objects.create(
|
|
116
|
+
old_path=Redirect.normalise_path(descendants.first().specific.url),
|
|
117
|
+
site=self.site,
|
|
118
|
+
redirect_link="/some-place",
|
|
119
|
+
automatically_created=False,
|
|
120
|
+
)
|
|
121
|
+
redirect2 = Redirect.objects.create(
|
|
122
|
+
old_path=Redirect.normalise_path(descendants.last().specific.url),
|
|
123
|
+
site=self.site,
|
|
124
|
+
redirect_link="/some-other-place",
|
|
125
|
+
automatically_created=True,
|
|
126
|
+
)
|
|
124
127
|
|
|
125
|
-
|
|
128
|
+
self.trigger_page_slug_changed_signal(test_subject)
|
|
126
129
|
|
|
127
130
|
# pre-existing manually-created redirects should be preserved
|
|
128
131
|
from_db = Redirect.objects.get(id=redirect1.id)
|
|
@@ -163,17 +166,18 @@ class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
|
|
163
166
|
)
|
|
164
167
|
|
|
165
168
|
def test_redirect_creation_for_custom_route_paths(self):
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
169
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
170
|
+
# Add a page that has overridden get_route_paths()
|
|
171
|
+
homepage = Page.objects.get(id=2)
|
|
172
|
+
routable_page = homepage.add_child(
|
|
173
|
+
instance=RoutablePageTest(
|
|
174
|
+
title="Routable Page",
|
|
175
|
+
live=True,
|
|
176
|
+
)
|
|
172
177
|
)
|
|
173
|
-
)
|
|
174
178
|
|
|
175
|
-
|
|
176
|
-
|
|
179
|
+
# Move from below the homepage to below the event index
|
|
180
|
+
routable_page.move(self.event_index, pos="last-child")
|
|
177
181
|
|
|
178
182
|
# Redirects should have been created for each path returned by get_route_paths()
|
|
179
183
|
self.assertEqual(
|
|
@@ -206,23 +210,24 @@ class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
|
|
206
210
|
)
|
|
207
211
|
|
|
208
212
|
def test_no_redirects_created_when_pages_are_moved_to_a_different_site(self):
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
213
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
214
|
+
# Add a new home page
|
|
215
|
+
homepage_2 = Page(
|
|
216
|
+
title="Second home",
|
|
217
|
+
slug="second-home",
|
|
218
|
+
)
|
|
219
|
+
root_page = Page.objects.get(depth=1)
|
|
220
|
+
root_page.add_child(instance=homepage_2)
|
|
221
|
+
|
|
222
|
+
# Create a site with the above as the root_page
|
|
223
|
+
Site.objects.create(
|
|
224
|
+
root_page=homepage_2,
|
|
225
|
+
hostname="newsite.com",
|
|
226
|
+
port=80,
|
|
227
|
+
)
|
|
223
228
|
|
|
224
|
-
|
|
225
|
-
|
|
229
|
+
# Move the event index to the new site
|
|
230
|
+
self.event_index.move(homepage_2, pos="last-child")
|
|
226
231
|
|
|
227
232
|
# No redirects should have been created
|
|
228
233
|
self.assertFalse(Redirect.objects.exists())
|
|
@@ -230,6 +235,7 @@ class TestAutocreateRedirects(WagtailTestUtils, TestCase):
|
|
|
230
235
|
|
|
231
236
|
@override_settings(WAGTAILREDIRECTS_AUTO_CREATE=False)
|
|
232
237
|
def test_no_redirects_created_if_disabled(self):
|
|
233
|
-
self.
|
|
238
|
+
with self.captureOnCommitCallbacks(execute=True):
|
|
239
|
+
self.trigger_page_slug_changed_signal(self.event_index)
|
|
234
240
|
self.assertFalse(Redirect.objects.exists())
|
|
235
241
|
self.assertEqual(len(PURGED_URLS), 0)
|
|
@@ -6,9 +6,9 @@ app_name = "wagtailredirects"
|
|
|
6
6
|
urlpatterns = [
|
|
7
7
|
path("", views.IndexView.as_view(), name="index"),
|
|
8
8
|
path("results/", views.IndexView.as_view(results_only=True), name="index_results"),
|
|
9
|
-
path("add/", views.
|
|
9
|
+
path("add/", views.CreateView.as_view(), name="add"),
|
|
10
10
|
path("<int:redirect_id>/", views.EditView.as_view(), name="edit"),
|
|
11
|
-
path("<int:redirect_id>/delete/", views.
|
|
11
|
+
path("<int:redirect_id>/delete/", views.DeleteView.as_view(), name="delete"),
|
|
12
12
|
path("import/", views.start_import, name="start_import"),
|
|
13
13
|
path("import/process/", views.process_import, name="process_import"),
|
|
14
14
|
]
|