wagtail 6.1.3__py3-none-any.whl → 6.2rc1__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 +15 -1
- wagtail/admin/checks.py +20 -30
- wagtail/admin/forms/pages.py +10 -0
- wagtail/admin/icons.py +43 -0
- wagtail/admin/locale/en/LC_MESSAGES/django.po +405 -295
- wagtail/admin/locale/en/LC_MESSAGES/djangojs.po +21 -3
- wagtail/admin/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/admin/locale/sl/LC_MESSAGES/django.po +30 -0
- wagtail/admin/menu.py +2 -2
- wagtail/admin/migrations/0004_editingsession.py +57 -0
- wagtail/admin/migrations/0005_editingsession_is_editing.py +18 -0
- wagtail/admin/models.py +36 -3
- wagtail/admin/rich_text/editors/draftail/__init__.py +2 -20
- wagtail/admin/static/wagtailadmin/css/core.css +1 -1
- wagtail/admin/static/wagtailadmin/js/bulk-actions.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-widget-telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/chooser-widget.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/date-time-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/draftail.js +1 -1
- wagtail/admin/static/wagtailadmin/js/expanding-formset.js +1 -1
- wagtail/admin/static/wagtailadmin/js/filtered-select.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/page-chooser-telepath.js +1 -1
- wagtail/admin/static/wagtailadmin/js/page-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/preview-panel.js +2 -1
- wagtail/admin/static/wagtailadmin/js/preview-panel.js.LICENSE.txt +11 -0
- wagtail/admin/static/wagtailadmin/js/privacy-switch.js +1 -1
- wagtail/admin/static/wagtailadmin/js/sidebar.js +1 -1
- wagtail/admin/static/wagtailadmin/js/task-chooser-modal.js +1 -1
- wagtail/admin/static/wagtailadmin/js/task-chooser.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/blocks.js +1 -1
- wagtail/admin/static/wagtailadmin/js/telepath/widgets.js +1 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js +2 -1
- wagtail/admin/static/wagtailadmin/js/userbar.js.LICENSE.txt +11 -0
- wagtail/admin/static/wagtailadmin/js/vendor.js +1 -1
- wagtail/admin/static/wagtailadmin/js/vendor.js.LICENSE.txt +0 -12
- wagtail/admin/static/wagtailadmin/js/wagtailadmin.js +1 -1
- wagtail/admin/static/wagtailadmin/js/workflow-action.js +1 -1
- wagtail/admin/templates/wagtailadmin/collection_privacy/ancestor_privacy.html +2 -6
- wagtail/admin/templates/wagtailadmin/generic/index_results.html +1 -17
- wagtail/admin/templates/wagtailadmin/generic/listing_results.html +20 -1
- wagtail/admin/templates/wagtailadmin/home/workflow_objects_to_moderate.html +2 -11
- wagtail/admin/templates/wagtailadmin/page_privacy/ancestor_privacy.html +2 -6
- wagtail/admin/templates/wagtailadmin/page_privacy/no_privacy.html +2 -0
- wagtail/admin/templates/wagtailadmin/pages/_editor_js.html +0 -1
- wagtail/admin/templates/wagtailadmin/pages/action_menu/menu.html +1 -1
- wagtail/admin/templates/wagtailadmin/reports/aging_pages_results.html +54 -0
- wagtail/admin/templates/wagtailadmin/reports/base_page_report.html +1 -17
- wagtail/admin/templates/wagtailadmin/reports/base_page_report_results.html +10 -0
- wagtail/admin/templates/wagtailadmin/reports/base_report.html +1 -40
- wagtail/admin/templates/wagtailadmin/reports/base_report_results.html +1 -0
- wagtail/admin/templates/wagtailadmin/reports/listing/_list_page_report.html +21 -27
- wagtail/admin/templates/wagtailadmin/reports/listing/_list_page_types_usage.html +48 -54
- wagtail/admin/templates/wagtailadmin/reports/{locked_pages.html → locked_pages_results.html} +3 -3
- wagtail/admin/templates/wagtailadmin/reports/page_types_usage_results.html +10 -0
- wagtail/admin/templates/wagtailadmin/reports/site_history_results.html +53 -0
- wagtail/admin/templates/wagtailadmin/reports/workflow_results.html +74 -0
- wagtail/admin/templates/wagtailadmin/reports/workflow_tasks_results.html +56 -0
- wagtail/admin/templates/wagtailadmin/shared/_workflow_init.html +8 -44
- wagtail/admin/templates/wagtailadmin/shared/avatar.html +11 -1
- wagtail/admin/templates/wagtailadmin/shared/dialog/dialog.html +5 -4
- wagtail/admin/templates/wagtailadmin/shared/dropdown/dropdown_button.html +2 -1
- wagtail/admin/templates/wagtailadmin/shared/editing_sessions/list.html +132 -0
- wagtail/admin/templates/wagtailadmin/shared/editing_sessions/module.html +44 -0
- wagtail/admin/templates/wagtailadmin/shared/headers/slim_header.html +7 -1
- wagtail/admin/templates/wagtailadmin/shared/page_status_tag_new.html +1 -1
- wagtail/admin/templates/wagtailadmin/shared/side_panels/checks.html +32 -16
- wagtail/admin/templates/wagtailadmin/skeleton.html +1 -1
- wagtail/admin/templates/wagtailadmin/userbar/item_accessibility.html +9 -11
- wagtail/admin/templatetags/wagtailadmin_tags.py +13 -2
- wagtail/admin/tests/formats/en/__init__.py +0 -0
- wagtail/admin/tests/formats/en/formats.py +1 -0
- wagtail/admin/tests/pages/test_create_page.py +47 -0
- wagtail/admin/tests/pages/test_edit_page.py +10 -8
- wagtail/admin/tests/pages/test_parent_page_chooser_view.py +45 -1
- wagtail/admin/tests/test_checks.py +53 -3
- wagtail/admin/tests/test_collections_views.py +62 -1
- wagtail/admin/tests/test_edit_handlers.py +37 -0
- wagtail/admin/tests/test_editing_sessions.py +1336 -0
- wagtail/admin/tests/test_icon_sprite.py +12 -21
- wagtail/admin/tests/test_page_chooser.py +309 -7
- wagtail/admin/tests/test_privacy.py +82 -0
- wagtail/admin/tests/test_reports_views.py +464 -70
- wagtail/admin/tests/test_userbar.py +93 -6
- wagtail/admin/tests/test_workflows.py +223 -33
- wagtail/admin/tests/viewsets/test_model_viewset.py +151 -2
- wagtail/admin/ui/editing_sessions.py +57 -0
- wagtail/admin/urls/__init__.py +9 -15
- wagtail/admin/urls/editing_sessions.py +17 -0
- wagtail/admin/urls/reports.py +33 -1
- wagtail/admin/userbar.py +77 -20
- wagtail/admin/views/chooser.py +49 -22
- wagtail/admin/views/collections.py +0 -11
- wagtail/admin/views/editing_sessions.py +193 -0
- wagtail/admin/views/generic/__init__.py +1 -0
- wagtail/admin/views/generic/history.py +9 -3
- wagtail/admin/views/generic/mixins.py +44 -3
- wagtail/admin/views/generic/models.py +46 -72
- wagtail/admin/views/generic/permissions.py +20 -10
- wagtail/admin/views/home.py +2 -31
- wagtail/admin/views/page_privacy.py +20 -5
- wagtail/admin/views/pages/choose_parent.py +62 -0
- wagtail/admin/views/pages/edit.py +28 -0
- wagtail/admin/views/reports/aging_pages.py +6 -10
- wagtail/admin/views/reports/audit_logging.py +13 -42
- wagtail/admin/views/reports/base.py +31 -4
- wagtail/admin/views/reports/locked_pages.py +5 -8
- wagtail/admin/views/reports/page_types_usage.py +6 -10
- wagtail/admin/views/reports/workflows.py +36 -12
- wagtail/admin/viewsets/base.py +8 -3
- wagtail/admin/viewsets/chooser.py +1 -1
- wagtail/admin/viewsets/model.py +26 -1
- wagtail/admin/wagtail_hooks.py +2 -1
- wagtail/api/v2/filters.py +6 -0
- wagtail/api/v2/tests/test_documents.py +1 -1
- wagtail/api/v2/tests/test_images.py +1 -1
- wagtail/api/v2/tests/test_pages.py +11 -1
- wagtail/api/v2/utils.py +2 -2
- wagtail/blocks/base.py +35 -12
- wagtail/blocks/definition_lookup.py +85 -0
- wagtail/blocks/list_block.py +12 -0
- wagtail/blocks/migrations/migrate_operation.py +2 -0
- wagtail/blocks/stream_block.py +19 -0
- wagtail/blocks/struct_block.py +19 -0
- wagtail/contrib/forms/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/frontend_cache/backends/__init__.py +5 -0
- wagtail/contrib/frontend_cache/backends/azure.py +179 -0
- wagtail/contrib/frontend_cache/backends/base.py +28 -0
- wagtail/contrib/frontend_cache/backends/cloudflare.py +114 -0
- wagtail/contrib/frontend_cache/backends/cloudfront.py +99 -0
- wagtail/contrib/frontend_cache/backends/http.py +64 -0
- wagtail/contrib/frontend_cache/tests.py +59 -17
- wagtail/contrib/frontend_cache/utils.py +26 -8
- wagtail/contrib/redirects/filters.py +15 -1
- wagtail/contrib/redirects/locale/en/LC_MESSAGES/django.po +37 -72
- wagtail/contrib/redirects/models.py +6 -5
- wagtail/contrib/redirects/templates/wagtailredirects/edit.html +1 -38
- wagtail/contrib/redirects/tests/test_redirects.py +141 -1
- wagtail/contrib/redirects/urls.py +1 -2
- wagtail/contrib/redirects/views.py +39 -80
- wagtail/contrib/routable_page/models.py +6 -4
- wagtail/contrib/routable_page/tests.py +11 -0
- wagtail/contrib/search_promotions/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/settings/locale/en/LC_MESSAGES/django.po +4 -4
- wagtail/contrib/simple_translation/locale/en/LC_MESSAGES/django.po +5 -1
- wagtail/contrib/simple_translation/models.py +2 -1
- wagtail/contrib/styleguide/locale/en/LC_MESSAGES/django.po +7 -7
- wagtail/contrib/table_block/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/contrib/table_block/static/table_block/js/table.js +1 -1
- wagtail/contrib/typed_table_block/blocks.py +19 -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 +38 -0
- wagtail/coreutils.py +1 -1
- wagtail/documents/__init__.py +1 -1
- wagtail/documents/locale/en/LC_MESSAGES/django.po +8 -8
- wagtail/documents/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/documents/locale/sl/LC_MESSAGES/django.po +20 -0
- wagtail/documents/models.py +5 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser-modal.js +1 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser-telepath.js +1 -1
- wagtail/documents/static/wagtaildocs/js/document-chooser.js +1 -1
- wagtail/documents/tests/test_models.py +5 -1
- wagtail/embeds/apps.py +2 -0
- wagtail/embeds/embeds.py +12 -14
- wagtail/embeds/finders/__init__.py +2 -0
- wagtail/embeds/finders/facebook.py +17 -33
- wagtail/embeds/finders/instagram.py +19 -16
- wagtail/embeds/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/embeds/signal_handlers.py +13 -0
- wagtail/embeds/tests/test_embeds.py +7 -7
- wagtail/fields.py +58 -14
- wagtail/images/__init__.py +1 -1
- wagtail/images/locale/en/LC_MESSAGES/django.po +34 -34
- wagtail/images/locale/sl/LC_MESSAGES/django.mo +0 -0
- wagtail/images/locale/sl/LC_MESSAGES/django.po +20 -0
- wagtail/images/models.py +2 -0
- wagtail/images/static/wagtailimages/js/image-chooser-modal.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/templates/wagtailimages/images/edit.html +4 -4
- wagtail/images/tests/test_admin_views.py +26 -2
- wagtail/images/views/chooser.py +6 -1
- wagtail/locale/en/LC_MESSAGES/django.po +84 -80
- wagtail/locales/locale/en/LC_MESSAGES/django.po +2 -2
- wagtail/locales/tests.py +16 -0
- wagtail/locales/wagtail_hooks.py +0 -9
- wagtail/migrations/0094_alter_page_locale.py +19 -0
- wagtail/models/__init__.py +11 -5
- wagtail/models/i18n.py +6 -1
- wagtail/project_template/requirements.txt +1 -1
- wagtail/search/locale/en/LC_MESSAGES/django.po +1 -1
- wagtail/signals.py +4 -0
- wagtail/sites/locale/en/LC_MESSAGES/django.po +2 -2
- wagtail/sites/tests.py +15 -0
- wagtail/sites/wagtail_hooks.py +0 -9
- wagtail/snippets/locale/en/LC_MESSAGES/django.po +9 -9
- wagtail/snippets/permissions.py +5 -3
- 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/snippets/action_menu/menu.html +1 -1
- wagtail/snippets/tests/test_snippets.py +78 -12
- wagtail/snippets/tests/test_viewset.py +22 -0
- wagtail/snippets/views/snippets.py +19 -14
- wagtail/snippets/wagtail_hooks.py +2 -10
- wagtail/templatetags/wagtailcore_tags.py +3 -0
- wagtail/test/dummy_external_storage.py +1 -1
- wagtail/test/i18n/migrations/0003_alter_clusterabletestmodel_locale_and_more.py +40 -0
- wagtail/test/routablepage/models.py +4 -0
- wagtail/test/snippets/migrations/0012_alter_translatablesnippet_locale.py +20 -0
- wagtail/test/testapp/migrations/0038_sociallink.py +52 -0
- wagtail/test/testapp/migrations/0039_alter_eventcategory_locale_and_more.py +45 -0
- wagtail/test/testapp/models.py +24 -0
- wagtail/test/testapp/views.py +1 -0
- wagtail/test/testapp/wagtail_hooks.py +9 -0
- wagtail/test/urls_multilang.py +6 -1
- wagtail/test/urls_multilang_non_root.py +11 -0
- wagtail/tests/streamfield_migrations/test_migrations.py +53 -12
- wagtail/tests/test_audit_log.py +72 -2
- wagtail/tests/test_blocks.py +103 -0
- wagtail/tests/test_signals.py +49 -2
- wagtail/tests/test_streamfield.py +153 -0
- wagtail/tests/test_utils.py +14 -0
- wagtail/tests/tests.py +5 -0
- wagtail/users/apps.py +1 -0
- wagtail/users/forms.py +7 -0
- wagtail/users/locale/en/LC_MESSAGES/django.po +55 -50
- wagtail/users/models.py +1 -0
- wagtail/users/templates/wagtailusers/groups/includes/formatted_permissions.html +3 -2
- wagtail/users/templatetags/wagtailusers_tags.py +9 -0
- wagtail/users/tests/__init__.py +7 -1
- wagtail/users/tests/test_admin_views.py +117 -32
- wagtail/users/views/groups.py +4 -0
- wagtail/users/views/users.py +58 -14
- wagtail/users/wagtail_hooks.py +7 -123
- wagtail/utils/utils.py +1 -0
- wagtail/utils/version.py +5 -2
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/METADATA +3 -3
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/RECORD +248 -222
- wagtail/admin/templates/wagtailadmin/reports/aging_pages.html +0 -58
- wagtail/admin/templates/wagtailadmin/reports/page_types_usage.html +0 -18
- wagtail/admin/templates/wagtailadmin/reports/site_history.html +0 -57
- wagtail/admin/templates/wagtailadmin/reports/workflow.html +0 -81
- wagtail/admin/templates/wagtailadmin/reports/workflow_tasks.html +0 -63
- wagtail/contrib/frontend_cache/backends.py +0 -400
- wagtail/contrib/redirects/templates/wagtailredirects/list.html +0 -43
- wagtail/contrib/redirects/templates/wagtailredirects/reports/redirects_report.html +0 -14
- wagtail/contrib/redirects/tests/test_reports_view.py +0 -82
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/LICENSE +0 -0
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/WHEEL +0 -0
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/entry_points.txt +0 -0
- {wagtail-6.1.3.dist-info → wagtail-6.2rc1.dist-info}/top_level.txt +0 -0
wagtail/sites/wagtail_hooks.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
from django.contrib.auth.models import Permission
|
|
2
1
|
from django.urls import reverse
|
|
3
2
|
from django.utils.translation import gettext_lazy as _
|
|
4
3
|
|
|
@@ -30,11 +29,3 @@ def register_sites_menu_item():
|
|
|
30
29
|
icon_name="site",
|
|
31
30
|
order=602,
|
|
32
31
|
)
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
@hooks.register("register_permissions")
|
|
36
|
-
def register_permissions():
|
|
37
|
-
return Permission.objects.filter(
|
|
38
|
-
content_type__app_label="wagtailcore",
|
|
39
|
-
codename__in=["add_site", "change_site", "delete_site"],
|
|
40
|
-
)
|
|
@@ -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-07-19 16:26+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"
|
|
@@ -182,35 +182,35 @@ msgstr ""
|
|
|
182
182
|
msgid "Choose"
|
|
183
183
|
msgstr ""
|
|
184
184
|
|
|
185
|
-
#: views/snippets.py:
|
|
186
|
-
#: wagtail_hooks.py:
|
|
185
|
+
#: views/snippets.py:76 views/snippets.py:104 views/snippets.py:891
|
|
186
|
+
#: wagtail_hooks.py:42
|
|
187
187
|
msgid "Snippets"
|
|
188
188
|
msgstr ""
|
|
189
189
|
|
|
190
|
-
#: views/snippets.py:
|
|
190
|
+
#: views/snippets.py:121
|
|
191
191
|
msgid "Name"
|
|
192
192
|
msgstr ""
|
|
193
193
|
|
|
194
|
-
#: views/snippets.py:
|
|
194
|
+
#: views/snippets.py:127
|
|
195
195
|
msgid "Instances"
|
|
196
196
|
msgstr ""
|
|
197
197
|
|
|
198
|
-
#: views/snippets.py:
|
|
198
|
+
#: views/snippets.py:219
|
|
199
199
|
#, python-format
|
|
200
200
|
msgid "More options for '%(title)s'"
|
|
201
201
|
msgstr ""
|
|
202
202
|
|
|
203
|
-
#: views/snippets.py:
|
|
203
|
+
#: views/snippets.py:367
|
|
204
204
|
#, python-format
|
|
205
205
|
msgid "Edit this %(model_name)s"
|
|
206
206
|
msgstr ""
|
|
207
207
|
|
|
208
|
-
#: views/snippets.py:
|
|
208
|
+
#: views/snippets.py:373
|
|
209
209
|
#, python-format
|
|
210
210
|
msgid "%(model_name)s history"
|
|
211
211
|
msgstr ""
|
|
212
212
|
|
|
213
|
-
#: views/snippets.py:
|
|
213
|
+
#: views/snippets.py:890
|
|
214
214
|
msgid "Home"
|
|
215
215
|
msgstr ""
|
|
216
216
|
|
wagtail/snippets/permissions.py
CHANGED
|
@@ -19,15 +19,17 @@ def user_can_edit_snippet_type(user, model):
|
|
|
19
19
|
return False
|
|
20
20
|
|
|
21
21
|
|
|
22
|
-
def
|
|
22
|
+
def user_can_access_snippets(user):
|
|
23
23
|
"""
|
|
24
|
-
true if user has 'add', 'change' or '
|
|
24
|
+
true if user has 'add', 'change', 'delete', or 'view' permission
|
|
25
25
|
on any model registered as a snippet type
|
|
26
26
|
"""
|
|
27
27
|
snippet_models = get_snippet_models()
|
|
28
28
|
|
|
29
29
|
for model in snippet_models:
|
|
30
|
-
if
|
|
30
|
+
if model.snippet_viewset.permission_policy.user_has_any_permission(
|
|
31
|
+
user, {"add", "change", "delete", "view"}
|
|
32
|
+
):
|
|
31
33
|
return True
|
|
32
34
|
|
|
33
35
|
return False
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e,r={8039:(e,r,t)=>{var o=t(2614),a=t(9465);class n extends o.ZZ{getURLParams(e){const r=super.getURLParams(e);return wagtailConfig.ACTIVE_CONTENT_LOCALE&&(r.locale=wagtailConfig.ACTIVE_CONTENT_LOCALE),r}}class i extends a.y{titleStateKey="string";chooserModalClass=n}class
|
|
1
|
+
(()=>{"use strict";var e,r={8039:(e,r,t)=>{var o=t(2614),a=t(9465);class n extends o.ZZ{getURLParams(e){const r=super.getURLParams(e);return wagtailConfig.ACTIVE_CONTENT_LOCALE&&(r.locale=wagtailConfig.ACTIVE_CONTENT_LOCALE),r}}class i extends a.y{titleStateKey="string";chooserModalClass=n}class s extends a._{widgetClass=i;chooserModalClass=n}window.telepath.register("wagtail.snippets.widgets.SnippetChooser",s)},1669:e=>{e.exports=jQuery}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(r,t,a,n)=>{if(!t){var i=1/0;for(d=0;d<e.length;d++){for(var[t,a,n]=e[d],s=!0,l=0;l<t.length;l++)(!1&n||i>=n)&&Object.keys(o.O).every((e=>o.O[e](t[l])))?t.splice(l--,1):(s=!1,n<i&&(i=n));if(s){e.splice(d--,1);var u=a();void 0!==u&&(r=u)}}return r}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[t,a,n]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.j=474,(()=>{var e={474:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var a,n,[i,s,l]=t,u=0;if(i.some((r=>0!==e[r]))){for(a in s)o.o(s,a)&&(o.m[a]=s[a]);if(l)var d=l(o)}for(r&&r(t);u<i.length;u++)n=i[u],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(d)},t=globalThis.webpackChunkwagtail=globalThis.webpackChunkwagtail||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var a=o.O(void 0,[321],(()=>o(8039)));a=o.O(a)})();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{"use strict";var e,r={9987:(e,r,t)=>{var o=t(2614),a=t(9465);class n extends o.ZZ{getURLParams(e){const r=super.getURLParams(e);return wagtailConfig.ACTIVE_CONTENT_LOCALE&&(r.locale=wagtailConfig.ACTIVE_CONTENT_LOCALE),r}}class i extends a.y{titleStateKey="string";chooserModalClass=n}window.SnippetChooser=i},1669:e=>{e.exports=jQuery}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={
|
|
1
|
+
(()=>{"use strict";var e,r={9987:(e,r,t)=>{var o=t(2614),a=t(9465);class n extends o.ZZ{getURLParams(e){const r=super.getURLParams(e);return wagtailConfig.ACTIVE_CONTENT_LOCALE&&(r.locale=wagtailConfig.ACTIVE_CONTENT_LOCALE),r}}class i extends a.y{titleStateKey="string";chooserModalClass=n}window.SnippetChooser=i},1669:e=>{e.exports=jQuery}},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var n=t[e]={exports:{}};return r[e](n,n.exports,o),n.exports}o.m=r,e=[],o.O=(r,t,a,n)=>{if(!t){var i=1/0;for(f=0;f<e.length;f++){for(var[t,a,n]=e[f],l=!0,s=0;s<t.length;s++)(!1&n||i>=n)&&Object.keys(o.O).every((e=>o.O[e](t[s])))?t.splice(s--,1):(l=!1,n<i&&(i=n));if(l){e.splice(f--,1);var u=a();void 0!==u&&(r=u)}}return r}n=n||0;for(var f=e.length;f>0&&e[f-1][2]>n;f--)e[f]=e[f-1];e[f]=[t,a,n]},o.n=e=>{var r=e&&e.__esModule?()=>e.default:()=>e;return o.d(r,{a:r}),r},o.d=(e,r)=>{for(var t in r)o.o(r,t)&&!o.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:r[t]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.j=686,(()=>{var e={686:0};o.O.j=r=>0===e[r];var r=(r,t)=>{var a,n,[i,l,s]=t,u=0;if(i.some((r=>0!==e[r]))){for(a in l)o.o(l,a)&&(o.m[a]=l[a]);if(s)var f=s(o)}for(r&&r(t);u<i.length;u++)n=i[u],o.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return o.O(f)},t=globalThis.webpackChunkwagtail=globalThis.webpackChunkwagtail||[];t.forEach(r.bind(null,0)),t.push=r.bind(null,t.push.bind(t))})();var a=o.O(void 0,[321],(()=>o(9987)));a=o.O(a)})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{% load wagtailadmin_tags %}
|
|
2
2
|
|
|
3
3
|
{% if show_menu %}
|
|
4
|
-
{% dropdown_button button=default_menu_item toggle_icon="arrow-up" %}
|
|
4
|
+
{% dropdown_button button=default_menu_item toggle_icon="arrow-up" keep_mounted=True %}
|
|
5
5
|
{% for item in rendered_menu_items %}
|
|
6
6
|
{{ item }}
|
|
7
7
|
{% endfor %}
|
|
@@ -24,9 +24,11 @@ from taggit.models import Tag
|
|
|
24
24
|
from wagtail import hooks
|
|
25
25
|
from wagtail.admin.admin_url_finder import AdminURLFinder
|
|
26
26
|
from wagtail.admin.forms import WagtailAdminModelForm
|
|
27
|
+
from wagtail.admin.menu import admin_menu
|
|
27
28
|
from wagtail.admin.panels import FieldPanel, ObjectList, get_edit_handler
|
|
28
29
|
from wagtail.admin.widgets.button import ButtonWithDropdown
|
|
29
30
|
from wagtail.blocks.field_block import FieldBlockAdapter
|
|
31
|
+
from wagtail.coreutils import get_dummy_request
|
|
30
32
|
from wagtail.models import Locale, ModelLogEntry, Revision
|
|
31
33
|
from wagtail.signals import published, unpublished
|
|
32
34
|
from wagtail.snippets.action_menu import (
|
|
@@ -95,6 +97,26 @@ class TestSnippetIndexView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
|
95
97
|
response = self.get()
|
|
96
98
|
self.assertEqual(response.status_code, 302)
|
|
97
99
|
|
|
100
|
+
def test_get_with_only_view_permissions(self):
|
|
101
|
+
self.user.is_superuser = False
|
|
102
|
+
self.user.user_permissions.add(
|
|
103
|
+
Permission.objects.get(
|
|
104
|
+
content_type__app_label="wagtailadmin", codename="access_admin"
|
|
105
|
+
),
|
|
106
|
+
Permission.objects.get(
|
|
107
|
+
content_type__app_label="tests", codename="view_advert"
|
|
108
|
+
),
|
|
109
|
+
)
|
|
110
|
+
self.user.save()
|
|
111
|
+
|
|
112
|
+
response = self.get()
|
|
113
|
+
self.assertEqual(response.status_code, 200)
|
|
114
|
+
self.assertTemplateUsed(response, "wagtailadmin/generic/listing.html")
|
|
115
|
+
soup = self.get_soup(response.content)
|
|
116
|
+
link = soup.select_one("tr td a")
|
|
117
|
+
self.assertEqual(link["href"], reverse("wagtailsnippets_tests_advert:list"))
|
|
118
|
+
self.assertEqual(link.text.strip(), "Adverts")
|
|
119
|
+
|
|
98
120
|
def test_simple(self):
|
|
99
121
|
response = self.get()
|
|
100
122
|
self.assertEqual(response.status_code, 200)
|
|
@@ -110,6 +132,29 @@ class TestSnippetIndexView(AdminTemplateTestUtils, WagtailTestUtils, TestCase):
|
|
|
110
132
|
def test_displays_snippet(self):
|
|
111
133
|
self.assertContains(self.get(), "Adverts")
|
|
112
134
|
|
|
135
|
+
def test_snippets_menu_item_shown_with_only_view_permission(self):
|
|
136
|
+
self.user.is_superuser = False
|
|
137
|
+
self.user.user_permissions.add(
|
|
138
|
+
Permission.objects.get(
|
|
139
|
+
content_type__app_label="wagtailadmin", codename="access_admin"
|
|
140
|
+
),
|
|
141
|
+
Permission.objects.get(
|
|
142
|
+
content_type__app_label="tests", codename="view_advert"
|
|
143
|
+
),
|
|
144
|
+
)
|
|
145
|
+
self.user.save()
|
|
146
|
+
|
|
147
|
+
request = get_dummy_request()
|
|
148
|
+
request.user = self.user
|
|
149
|
+
menu_items = admin_menu.menu_items_for_request(request)
|
|
150
|
+
snippets = [item for item in menu_items if item.name == "snippets"]
|
|
151
|
+
self.assertEqual(len(snippets), 1)
|
|
152
|
+
item = snippets[0]
|
|
153
|
+
self.assertEqual(item.name, "snippets")
|
|
154
|
+
self.assertEqual(item.label, "Snippets")
|
|
155
|
+
self.assertEqual(item.icon_name, "snippet")
|
|
156
|
+
self.assertEqual(item.url, reverse("wagtailsnippets:index"))
|
|
157
|
+
|
|
113
158
|
|
|
114
159
|
class TestSnippetListView(WagtailTestUtils, TestCase):
|
|
115
160
|
def setUp(self):
|
|
@@ -319,6 +364,23 @@ class TestSnippetListView(WagtailTestUtils, TestCase):
|
|
|
319
364
|
self.assertEqual(response.status_code, 200)
|
|
320
365
|
self.assertTemplateUsed(response, "wagtailadmin/shared/buttons.html")
|
|
321
366
|
|
|
367
|
+
def test_dropdown_not_rendered_when_no_child_buttons_exist(self):
|
|
368
|
+
Advert.objects.create(text="My Lovely advert")
|
|
369
|
+
|
|
370
|
+
def remove_all_buttons(buttons, snippet, user):
|
|
371
|
+
buttons[:] = []
|
|
372
|
+
self.assertEqual(len(buttons), 0)
|
|
373
|
+
|
|
374
|
+
with hooks.register_temporarily(
|
|
375
|
+
"construct_snippet_listing_buttons",
|
|
376
|
+
remove_all_buttons,
|
|
377
|
+
):
|
|
378
|
+
response = self.get()
|
|
379
|
+
|
|
380
|
+
soup = self.get_soup(response.content)
|
|
381
|
+
actions = soup.select_one("tbody tr td ul.actions")
|
|
382
|
+
self.assertIsNone(actions)
|
|
383
|
+
|
|
322
384
|
def test_use_latest_draft_as_title(self):
|
|
323
385
|
snippet = DraftStateModel.objects.create(text="Draft-enabled Foo, Published")
|
|
324
386
|
snippet.save_revision().publish()
|
|
@@ -1124,12 +1186,14 @@ class TestCreateDraftStateSnippet(WagtailTestUtils, TestCase):
|
|
|
1124
1186
|
allow_extra_attrs=True,
|
|
1125
1187
|
)
|
|
1126
1188
|
# Should show the dialog template pointing to the [data-edit-form] selector as the root
|
|
1127
|
-
self.
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1189
|
+
soup = self.get_soup(html)
|
|
1190
|
+
dialog = soup.select_one(
|
|
1191
|
+
"""
|
|
1192
|
+
template[data-controller="w-teleport"][data-w-teleport-target-value="[data-edit-form]"]
|
|
1193
|
+
#schedule-publishing-dialog
|
|
1194
|
+
"""
|
|
1195
|
+
)
|
|
1196
|
+
self.assertIsNotNone(dialog)
|
|
1133
1197
|
# Should render the main form with data-edit-form attribute
|
|
1134
1198
|
self.assertTagInHTML(
|
|
1135
1199
|
f'<form action="{add_url}" method="POST" data-edit-form>',
|
|
@@ -1524,12 +1588,14 @@ class BaseTestSnippetEditView(WagtailTestUtils, TestCase):
|
|
|
1524
1588
|
allow_extra_attrs=True,
|
|
1525
1589
|
)
|
|
1526
1590
|
# Should show the dialog template pointing to the [data-edit-form] selector as the root
|
|
1527
|
-
self.
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1591
|
+
soup = self.get_soup(html)
|
|
1592
|
+
dialog = soup.select_one(
|
|
1593
|
+
"""
|
|
1594
|
+
template[data-controller="w-teleport"][data-w-teleport-target-value="[data-edit-form]"]
|
|
1595
|
+
#schedule-publishing-dialog
|
|
1596
|
+
"""
|
|
1597
|
+
)
|
|
1598
|
+
self.assertIsNotNone(dialog)
|
|
1533
1599
|
# Should render the main form with data-edit-form attribute
|
|
1534
1600
|
self.assertTagInHTML(
|
|
1535
1601
|
f'<form action="{self.get_edit_url()}" method="POST" data-edit-form>',
|
|
@@ -1607,3 +1607,25 @@ class TestCustomMethods(BaseSnippetViewSetTests):
|
|
|
1607
1607
|
self.assertIsNotNone(template)
|
|
1608
1608
|
links = template.find_all("a", attrs={"href": add_url})
|
|
1609
1609
|
self.assertEqual(len(links), 1)
|
|
1610
|
+
|
|
1611
|
+
|
|
1612
|
+
class TestCustomPermissionPolicy(BaseSnippetViewSetTests):
|
|
1613
|
+
model = FullFeaturedSnippet
|
|
1614
|
+
|
|
1615
|
+
@classmethod
|
|
1616
|
+
def setUpTestData(cls):
|
|
1617
|
+
cls.object = cls.model.objects.create(text="Hello World")
|
|
1618
|
+
|
|
1619
|
+
def test_get_edit_view_not_allowed(self):
|
|
1620
|
+
response = self.client.get(self.get_url("edit", args=(quote(self.object.pk),)))
|
|
1621
|
+
self.assertEqual(response.status_code, 200)
|
|
1622
|
+
|
|
1623
|
+
# The custom permission policy disallows any user with [FORBIDDEN]
|
|
1624
|
+
# in their name, even if they are a superuser
|
|
1625
|
+
self.user.first_name = "[FORBIDDEN]"
|
|
1626
|
+
self.user.last_name = "Joe"
|
|
1627
|
+
self.user.save()
|
|
1628
|
+
self.assertTrue(self.user.is_superuser)
|
|
1629
|
+
self.assertEqual(self.user.get_full_name(), "[FORBIDDEN] Joe")
|
|
1630
|
+
response = self.client.get(self.get_url("edit", args=(quote(self.object.pk),)))
|
|
1631
|
+
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
|
@@ -47,7 +47,6 @@ from wagtail.models import (
|
|
|
47
47
|
from wagtail.permissions import ModelPermissionPolicy
|
|
48
48
|
from wagtail.snippets.action_menu import SnippetActionMenu
|
|
49
49
|
from wagtail.snippets.models import SnippetAdminURLFinder, get_snippet_models
|
|
50
|
-
from wagtail.snippets.permissions import user_can_edit_snippet_type
|
|
51
50
|
from wagtail.snippets.side_panels import SnippetStatusSidePanel
|
|
52
51
|
from wagtail.snippets.views.chooser import SnippetChooserViewSet
|
|
53
52
|
from wagtail.utils.deprecation import RemovedInWagtail70Warning
|
|
@@ -90,9 +89,10 @@ class ModelIndexView(generic.BaseListingView):
|
|
|
90
89
|
"name": capfirst(model._meta.verbose_name_plural),
|
|
91
90
|
"count": model._default_manager.all().count(),
|
|
92
91
|
"model": model,
|
|
92
|
+
"url": url,
|
|
93
93
|
}
|
|
94
94
|
for model in get_snippet_models()
|
|
95
|
-
if
|
|
95
|
+
if (url := self.get_list_url(model))
|
|
96
96
|
]
|
|
97
97
|
|
|
98
98
|
def dispatch(self, request, *args, **kwargs):
|
|
@@ -103,8 +103,12 @@ class ModelIndexView(generic.BaseListingView):
|
|
|
103
103
|
def get_breadcrumbs_items(self):
|
|
104
104
|
return self.breadcrumbs_items + [{"url": "", "label": _("Snippets")}]
|
|
105
105
|
|
|
106
|
-
def get_list_url(self,
|
|
107
|
-
|
|
106
|
+
def get_list_url(self, model):
|
|
107
|
+
if model.snippet_viewset.permission_policy.user_has_any_permission(
|
|
108
|
+
self.request.user,
|
|
109
|
+
{"add", "change", "delete", "view"},
|
|
110
|
+
):
|
|
111
|
+
return reverse(model.snippet_viewset.get_url_name("list"))
|
|
108
112
|
|
|
109
113
|
def get_queryset(self):
|
|
110
114
|
return None
|
|
@@ -115,7 +119,7 @@ class ModelIndexView(generic.BaseListingView):
|
|
|
115
119
|
TitleColumn(
|
|
116
120
|
"name",
|
|
117
121
|
label=_("Name"),
|
|
118
|
-
get_url=
|
|
122
|
+
get_url=lambda type: type["url"],
|
|
119
123
|
sort_key="name",
|
|
120
124
|
),
|
|
121
125
|
Column(
|
|
@@ -206,16 +210,17 @@ class IndexView(generic.IndexViewOptionalFeaturesMixin, generic.IndexView):
|
|
|
206
210
|
)
|
|
207
211
|
hook(more_buttons, instance, self.request.user, {})
|
|
208
212
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
213
|
+
if more_buttons:
|
|
214
|
+
list_buttons.append(
|
|
215
|
+
ButtonWithDropdown(
|
|
216
|
+
buttons=more_buttons,
|
|
217
|
+
icon_name="dots-horizontal",
|
|
218
|
+
attrs={
|
|
219
|
+
"aria-label": _("More options for '%(title)s'")
|
|
220
|
+
% {"title": str(instance)},
|
|
221
|
+
},
|
|
222
|
+
)
|
|
217
223
|
)
|
|
218
|
-
)
|
|
219
224
|
|
|
220
225
|
return list_buttons
|
|
221
226
|
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
from django.contrib.auth.models import Permission
|
|
2
|
-
from django.contrib.contenttypes.models import ContentType
|
|
3
1
|
from django.urls import include, path, reverse
|
|
4
2
|
from django.utils.functional import cached_property
|
|
5
3
|
from django.utils.translation import gettext_lazy as _
|
|
@@ -8,7 +6,7 @@ from wagtail import hooks
|
|
|
8
6
|
from wagtail.admin.menu import MenuItem
|
|
9
7
|
from wagtail.snippets.bulk_actions.delete import DeleteBulkAction
|
|
10
8
|
from wagtail.snippets.models import get_snippet_models
|
|
11
|
-
from wagtail.snippets.permissions import
|
|
9
|
+
from wagtail.snippets.permissions import user_can_access_snippets
|
|
12
10
|
from wagtail.snippets.views import snippets as snippet_views
|
|
13
11
|
|
|
14
12
|
|
|
@@ -35,7 +33,7 @@ class SnippetsMenuItem(MenuItem):
|
|
|
35
33
|
)
|
|
36
34
|
|
|
37
35
|
def is_shown(self, request):
|
|
38
|
-
return not self._all_have_menu_items and
|
|
36
|
+
return not self._all_have_menu_items and user_can_access_snippets(request.user)
|
|
39
37
|
|
|
40
38
|
|
|
41
39
|
@hooks.register("register_admin_menu_item")
|
|
@@ -49,10 +47,4 @@ def register_snippets_menu_item():
|
|
|
49
47
|
)
|
|
50
48
|
|
|
51
49
|
|
|
52
|
-
@hooks.register("register_permissions")
|
|
53
|
-
def register_permissions():
|
|
54
|
-
content_types = ContentType.objects.get_for_models(*get_snippet_models()).values()
|
|
55
|
-
return Permission.objects.filter(content_type__in=content_types)
|
|
56
|
-
|
|
57
|
-
|
|
58
50
|
hooks.register("register_bulk_action", DeleteBulkAction)
|
|
@@ -3,6 +3,7 @@ from django.shortcuts import resolve_url
|
|
|
3
3
|
from django.template.defaulttags import token_kwargs
|
|
4
4
|
from django.template.loader import render_to_string
|
|
5
5
|
from django.utils.encoding import force_str
|
|
6
|
+
from django.utils.functional import Promise
|
|
6
7
|
from django.utils.html import conditional_escape
|
|
7
8
|
|
|
8
9
|
from wagtail import VERSION, __version__
|
|
@@ -120,6 +121,8 @@ def richtext(value):
|
|
|
120
121
|
elif value is None:
|
|
121
122
|
html = ""
|
|
122
123
|
else:
|
|
124
|
+
if isinstance(value, Promise):
|
|
125
|
+
value = str(value)
|
|
123
126
|
if isinstance(value, str):
|
|
124
127
|
html = expand_db_html(value)
|
|
125
128
|
else:
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
# - File.size exceptions raise DummyExternalStorageError
|
|
8
8
|
# - Storage._save() fails loudly if the content file's pointer is not at the start
|
|
9
9
|
|
|
10
|
-
from django.core.files
|
|
10
|
+
from django.core.files import File
|
|
11
11
|
from django.core.files.storage import FileSystemStorage, Storage
|
|
12
12
|
from django.utils.deconstruct import deconstructible
|
|
13
13
|
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-06-21 06:47
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('i18n', '0002_clusterabletestmodel_clusterabletestmodelchild_clusterabletestmodeltranslatablechild'),
|
|
11
|
+
('wagtailcore', '0094_alter_page_locale'),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.AlterField(
|
|
16
|
+
model_name='clusterabletestmodel',
|
|
17
|
+
name='locale',
|
|
18
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
19
|
+
),
|
|
20
|
+
migrations.AlterField(
|
|
21
|
+
model_name='clusterabletestmodeltranslatablechild',
|
|
22
|
+
name='locale',
|
|
23
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
24
|
+
),
|
|
25
|
+
migrations.AlterField(
|
|
26
|
+
model_name='testchildobject',
|
|
27
|
+
name='locale',
|
|
28
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
29
|
+
),
|
|
30
|
+
migrations.AlterField(
|
|
31
|
+
model_name='testmodel',
|
|
32
|
+
name='locale',
|
|
33
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
34
|
+
),
|
|
35
|
+
migrations.AlterField(
|
|
36
|
+
model_name='testnonparentalchildobject',
|
|
37
|
+
name='locale',
|
|
38
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
39
|
+
),
|
|
40
|
+
]
|
|
@@ -62,6 +62,10 @@ class RoutablePageTest(RoutablePage):
|
|
|
62
62
|
template="routablepagetests/routable_page_test_alternate.html",
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
+
@route(r"^render-method-with-arg/(?P<slug>.+)/$")
|
|
66
|
+
def render_method_test_with_arg(self, request, slug):
|
|
67
|
+
return self.render(request)
|
|
68
|
+
|
|
65
69
|
def get_route_paths(self):
|
|
66
70
|
return [
|
|
67
71
|
"/",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-06-21 06:47
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('snippetstests', '0011_nonautocompletesearchablesnippet'),
|
|
11
|
+
('wagtailcore', '0094_alter_page_locale'),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.AlterField(
|
|
16
|
+
model_name='translatablesnippet',
|
|
17
|
+
name='locale',
|
|
18
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
19
|
+
),
|
|
20
|
+
]
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Generated by Django 4.2.13 on 2024-06-12 12:06
|
|
2
|
+
|
|
3
|
+
from django.db import migrations, models
|
|
4
|
+
import django.db.models.deletion
|
|
5
|
+
import modelcluster.fields
|
|
6
|
+
import wagtail.search.index
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Migration(migrations.Migration):
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
("tests", "0037_testpermissionedgenericsetting_and_more"),
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
operations = [
|
|
16
|
+
migrations.CreateModel(
|
|
17
|
+
name="SocialLink",
|
|
18
|
+
fields=[
|
|
19
|
+
(
|
|
20
|
+
"id",
|
|
21
|
+
models.AutoField(
|
|
22
|
+
auto_created=True,
|
|
23
|
+
primary_key=True,
|
|
24
|
+
serialize=False,
|
|
25
|
+
verbose_name="ID",
|
|
26
|
+
),
|
|
27
|
+
),
|
|
28
|
+
("url", models.URLField()),
|
|
29
|
+
(
|
|
30
|
+
"kind",
|
|
31
|
+
models.CharField(
|
|
32
|
+
choices=[("twitter", "Twitter"), ("facebook", "Facebook")],
|
|
33
|
+
max_length=30,
|
|
34
|
+
),
|
|
35
|
+
),
|
|
36
|
+
(
|
|
37
|
+
"person",
|
|
38
|
+
modelcluster.fields.ParentalKey(
|
|
39
|
+
on_delete=django.db.models.deletion.CASCADE,
|
|
40
|
+
related_name="social_links",
|
|
41
|
+
to="tests.personpage",
|
|
42
|
+
verbose_name="Person",
|
|
43
|
+
),
|
|
44
|
+
),
|
|
45
|
+
],
|
|
46
|
+
options={
|
|
47
|
+
"verbose_name": "Social link",
|
|
48
|
+
"verbose_name_plural": "Social links",
|
|
49
|
+
},
|
|
50
|
+
bases=(wagtail.search.index.Indexed, models.Model),
|
|
51
|
+
),
|
|
52
|
+
]
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# Generated by Django 5.0.6 on 2024-06-21 06:47
|
|
2
|
+
|
|
3
|
+
import django.db.models.deletion
|
|
4
|
+
from django.db import migrations, models
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Migration(migrations.Migration):
|
|
8
|
+
|
|
9
|
+
dependencies = [
|
|
10
|
+
('tests', '0038_sociallink'),
|
|
11
|
+
('wagtailcore', '0094_alter_page_locale'),
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
operations = [
|
|
15
|
+
migrations.AlterField(
|
|
16
|
+
model_name='eventcategory',
|
|
17
|
+
name='locale',
|
|
18
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
19
|
+
),
|
|
20
|
+
migrations.AlterField(
|
|
21
|
+
model_name='eventpagecarouselitem',
|
|
22
|
+
name='locale',
|
|
23
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
24
|
+
),
|
|
25
|
+
migrations.AlterField(
|
|
26
|
+
model_name='eventpagerelatedlink',
|
|
27
|
+
name='locale',
|
|
28
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
29
|
+
),
|
|
30
|
+
migrations.AlterField(
|
|
31
|
+
model_name='eventpagespeaker',
|
|
32
|
+
name='locale',
|
|
33
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
34
|
+
),
|
|
35
|
+
migrations.AlterField(
|
|
36
|
+
model_name='eventpagespeakeraward',
|
|
37
|
+
name='locale',
|
|
38
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
39
|
+
),
|
|
40
|
+
migrations.AlterField(
|
|
41
|
+
model_name='fullfeaturedsnippet',
|
|
42
|
+
name='locale',
|
|
43
|
+
field=models.ForeignKey(editable=False, on_delete=django.db.models.deletion.PROTECT, related_name='+', to='wagtailcore.locale', verbose_name='locale'),
|
|
44
|
+
),
|
|
45
|
+
]
|
wagtail/test/testapp/models.py
CHANGED
|
@@ -2097,6 +2097,7 @@ class PersonPage(Page):
|
|
|
2097
2097
|
"Person",
|
|
2098
2098
|
),
|
|
2099
2099
|
InlinePanel("addresses", label="Address"),
|
|
2100
|
+
InlinePanel("social_links", label="Social links"),
|
|
2100
2101
|
]
|
|
2101
2102
|
|
|
2102
2103
|
class Meta:
|
|
@@ -2133,6 +2134,29 @@ class AddressTag(TaggedItemBase):
|
|
|
2133
2134
|
)
|
|
2134
2135
|
|
|
2135
2136
|
|
|
2137
|
+
class SocialLink(index.Indexed, ClusterableModel):
|
|
2138
|
+
url = models.URLField()
|
|
2139
|
+
kind = models.CharField(
|
|
2140
|
+
max_length=30,
|
|
2141
|
+
choices=[
|
|
2142
|
+
("twitter", "Twitter"),
|
|
2143
|
+
("facebook", "Facebook"),
|
|
2144
|
+
],
|
|
2145
|
+
)
|
|
2146
|
+
person = ParentalKey(
|
|
2147
|
+
to="tests.PersonPage", related_name="social_links", verbose_name="Person"
|
|
2148
|
+
)
|
|
2149
|
+
|
|
2150
|
+
panels = [
|
|
2151
|
+
FieldPanel("url"),
|
|
2152
|
+
FieldPanel("kind"),
|
|
2153
|
+
]
|
|
2154
|
+
|
|
2155
|
+
class Meta:
|
|
2156
|
+
verbose_name = "Social link"
|
|
2157
|
+
verbose_name_plural = "Social links"
|
|
2158
|
+
|
|
2159
|
+
|
|
2136
2160
|
class RestaurantPage(Page):
|
|
2137
2161
|
tags = ClusterTaggableManager(through="tests.TaggedRestaurant", blank=True)
|
|
2138
2162
|
|