wagtail 6.0.3__py3-none-any.whl → 6.0.4__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/admin/views/generic/__init__.py +1 -0
- wagtail/admin/views/generic/models.py +10 -4
- wagtail/snippets/tests/test_snippets.py +18 -10
- wagtail/snippets/views/snippets.py +3 -11
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/METADATA +1 -1
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/RECORD +11 -11
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/LICENSE +0 -0
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/WHEEL +0 -0
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/entry_points.txt +0 -0
- {wagtail-6.0.3.dist-info → wagtail-6.0.4.dist-info}/top_level.txt +0 -0
wagtail/__init__.py
CHANGED
|
@@ -6,7 +6,7 @@ from wagtail.utils.version import get_semver_version, get_version
|
|
|
6
6
|
|
|
7
7
|
# major.minor.patch.release.number
|
|
8
8
|
# release must be one of alpha, beta, rc, or final
|
|
9
|
-
VERSION = (6, 0,
|
|
9
|
+
VERSION = (6, 0, 4, "final", 1)
|
|
10
10
|
|
|
11
11
|
__version__ = get_version(VERSION)
|
|
12
12
|
|
|
@@ -676,12 +676,18 @@ class CreateView(
|
|
|
676
676
|
return super().form_invalid(form)
|
|
677
677
|
|
|
678
678
|
|
|
679
|
-
class
|
|
679
|
+
class CopyViewMixin:
|
|
680
680
|
def get_object(self, queryset=None):
|
|
681
|
-
return get_object_or_404(
|
|
681
|
+
return get_object_or_404(
|
|
682
|
+
self.model, pk=unquote(str(self.kwargs[self.pk_url_kwarg]))
|
|
683
|
+
)
|
|
682
684
|
|
|
683
|
-
def
|
|
684
|
-
return
|
|
685
|
+
def get_initial_form_instance(self):
|
|
686
|
+
return self.get_object()
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
class CopyView(CopyViewMixin, CreateView):
|
|
690
|
+
pass
|
|
685
691
|
|
|
686
692
|
|
|
687
693
|
class EditView(
|
|
@@ -35,7 +35,6 @@ from wagtail.snippets.action_menu import (
|
|
|
35
35
|
)
|
|
36
36
|
from wagtail.snippets.blocks import SnippetChooserBlock
|
|
37
37
|
from wagtail.snippets.models import SNIPPET_MODELS, register_snippet
|
|
38
|
-
from wagtail.snippets.views.snippets import CopyView
|
|
39
38
|
from wagtail.snippets.widgets import (
|
|
40
39
|
AdminSnippetChooser,
|
|
41
40
|
SnippetChooserAdapter,
|
|
@@ -974,20 +973,29 @@ class TestSnippetCopyView(WagtailTestUtils, TestCase):
|
|
|
974
973
|
StandardSnippet.snippet_viewset.get_url_name("copy"),
|
|
975
974
|
args=(self.snippet.pk,),
|
|
976
975
|
)
|
|
977
|
-
self.login()
|
|
976
|
+
self.user = self.login()
|
|
977
|
+
|
|
978
|
+
def test_without_permission(self):
|
|
979
|
+
self.user.is_superuser = False
|
|
980
|
+
self.user.save()
|
|
981
|
+
admin_permission = Permission.objects.get(
|
|
982
|
+
content_type__app_label="wagtailadmin", codename="access_admin"
|
|
983
|
+
)
|
|
984
|
+
self.user.user_permissions.add(admin_permission)
|
|
978
985
|
|
|
979
|
-
|
|
986
|
+
response = self.client.get(self.url)
|
|
987
|
+
self.assertEqual(response.status_code, 302)
|
|
988
|
+
self.assertRedirects(response, reverse("wagtailadmin_home"))
|
|
989
|
+
|
|
990
|
+
def test_form_is_prefilled(self):
|
|
980
991
|
response = self.client.get(self.url)
|
|
981
992
|
self.assertEqual(response.status_code, 200)
|
|
982
993
|
self.assertTemplateUsed(response, "wagtailsnippets/snippets/create.html")
|
|
983
994
|
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
view.setup(request, pk=self.snippet.pk)
|
|
989
|
-
|
|
990
|
-
self.assertEqual(view._get_initial_form_instance(), self.snippet)
|
|
995
|
+
# Ensure form is prefilled
|
|
996
|
+
soup = self.get_soup(response.content)
|
|
997
|
+
text_input = soup.select_one('input[name="text"]')
|
|
998
|
+
self.assertEqual(text_input.attrs.get("value"), "Test snippet")
|
|
991
999
|
|
|
992
1000
|
|
|
993
1001
|
@override_settings(WAGTAIL_I18N_ENABLED=True)
|
|
@@ -5,7 +5,7 @@ from django.contrib.admin.utils import quote
|
|
|
5
5
|
from django.core import checks
|
|
6
6
|
from django.core.exceptions import ImproperlyConfigured, PermissionDenied
|
|
7
7
|
from django.http import Http404
|
|
8
|
-
from django.shortcuts import
|
|
8
|
+
from django.shortcuts import redirect
|
|
9
9
|
from django.urls import path, re_path, reverse, reverse_lazy
|
|
10
10
|
from django.utils.functional import cached_property
|
|
11
11
|
from django.utils.text import capfirst
|
|
@@ -264,16 +264,8 @@ class CreateView(generic.CreateEditViewOptionalFeaturesMixin, generic.CreateView
|
|
|
264
264
|
return context
|
|
265
265
|
|
|
266
266
|
|
|
267
|
-
class CopyView(CreateView):
|
|
268
|
-
|
|
269
|
-
return get_object_or_404(self.model, pk=self.kwargs["pk"])
|
|
270
|
-
|
|
271
|
-
def _get_initial_form_instance(self):
|
|
272
|
-
instance = self.get_object()
|
|
273
|
-
# Set locale of the new instance
|
|
274
|
-
if self.locale:
|
|
275
|
-
instance.locale = self.locale
|
|
276
|
-
return instance
|
|
267
|
+
class CopyView(generic.CopyViewMixin, CreateView):
|
|
268
|
+
pass
|
|
277
269
|
|
|
278
270
|
|
|
279
271
|
class EditView(generic.CreateEditViewOptionalFeaturesMixin, generic.EditView):
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
wagtail/__init__.py,sha256=
|
|
1
|
+
wagtail/__init__.py,sha256=qlk_KgJCF4VHS9RXzTg1O1YmSGd9NQhh0aWmbeByUqI,724
|
|
2
2
|
wagtail/apps.py,sha256=38kXTdHoQzFnpUqDNxFpsqn2dut4V0u9rLOkhqCoYkc,713
|
|
3
3
|
wagtail/compat.py,sha256=L41FhlX4xy5KgTdJ63smtM78mtKf1mxkPeOs8kyOwS0,538
|
|
4
4
|
wagtail/coreutils.py,sha256=2eFnlfuyzu8wr5_u2j_zbrHhQDPxPfnaIlgRc4433J0,20660
|
|
@@ -931,13 +931,13 @@ wagtail/admin/views/bulk_action/__init__.py,sha256=vvb1oKmExfxl6cd6g7YaCO4LSwxWN
|
|
|
931
931
|
wagtail/admin/views/bulk_action/base_bulk_action.py,sha256=UuidpHVm3uQTI6zRYxwSgxZNkAVP_XCWhkCEMW0Wu1s,5201
|
|
932
932
|
wagtail/admin/views/bulk_action/dispatcher.py,sha256=fqhOJ3tyRwIDP474vewlsAq1FgP48AgKOvdiySxDlto,504
|
|
933
933
|
wagtail/admin/views/bulk_action/registry.py,sha256=e9-rN9TdHUmRwDfTeauvPUjE6p3ipqReiuhxAhQDnJc,1640
|
|
934
|
-
wagtail/admin/views/generic/__init__.py,sha256=
|
|
934
|
+
wagtail/admin/views/generic/__init__.py,sha256=DmUsijsaRTmV5htoqydJ74OKuu4AiuhThvTFflCguok,683
|
|
935
935
|
wagtail/admin/views/generic/base.py,sha256=iJKNGAd3orZOzLGviEfCF9rjdfo_hK3QCIDAAMkXcdQ,16705
|
|
936
936
|
wagtail/admin/views/generic/chooser.py,sha256=pjOYGcYBHc1ZkZJ4LWcHkoGNQ7U7GdKBsJZ0vyOO4kc,18061
|
|
937
937
|
wagtail/admin/views/generic/history.py,sha256=gsjOYx5aHv1s3klx_5VuZwsPqEaxV_8kucswr6MUTVE,10764
|
|
938
938
|
wagtail/admin/views/generic/lock.py,sha256=dvZ613n3itNAhO3zdQzGRewm2kH-dyemx-LSuUC2AHM,1435
|
|
939
939
|
wagtail/admin/views/generic/mixins.py,sha256=s17uj8lGDOI2zi3oH3HDJUem3tDddYQc3mrNxc-J_-I,28349
|
|
940
|
-
wagtail/admin/views/generic/models.py,sha256=
|
|
940
|
+
wagtail/admin/views/generic/models.py,sha256=WurcJDa8xinxo0JmjrHXL8h2Pfi7tKfgMPiMDx2mZXM,50949
|
|
941
941
|
wagtail/admin/views/generic/multiple_upload.py,sha256=rgf3uXZShyZ_2rnidfk_tnU4YhHcXyPwrIKMKWIk78s,13031
|
|
942
942
|
wagtail/admin/views/generic/permissions.py,sha256=8WY3Pd3jt3sPH4CNaQqmhUvgb1YjD3fjIgkqh7zRjbc,1476
|
|
943
943
|
wagtail/admin/views/generic/preview.py,sha256=9tvUJoz55b0bKY4vvfqnDMNke3TTeSPaEamvrICYR9Q,5655
|
|
@@ -3464,7 +3464,7 @@ wagtail/snippets/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3
|
|
|
3464
3464
|
wagtail/snippets/tests/test_locking.py,sha256=QdaRVuX47tCbwoA62KYNJm9qxH33ekKs-nai5UeYDp4,25370
|
|
3465
3465
|
wagtail/snippets/tests/test_management.py,sha256=GQw8HCZSJWny8giAUua_5-RstN7U_QGcsOkVuG72YHM,894
|
|
3466
3466
|
wagtail/snippets/tests/test_preview.py,sha256=BpsAvmWJ2cX4zGZHbJg42lwIAztUTAgF_k9KRJWsSEw,19848
|
|
3467
|
-
wagtail/snippets/tests/test_snippets.py,sha256
|
|
3467
|
+
wagtail/snippets/tests/test_snippets.py,sha256=-Oyh2bCgIAsmasdI_xjKQ6PiTPeKdGOlv79g4_nUJ-0,215147
|
|
3468
3468
|
wagtail/snippets/tests/test_usage.py,sha256=2nAyuC5Nt3PbDnJgXNRAP_KDEt1gf_SGPiYL4IgmMWY,8076
|
|
3469
3469
|
wagtail/snippets/tests/test_viewset.py,sha256=yCvlGerr5VbubC8I6W4ZlKS0yC7gMtsdA4cspski4JU,59972
|
|
3470
3470
|
wagtail/snippets/tests/test_workflows.py,sha256=cbE1K46mCjb2yhaT5FGGKAXlZiirvWbKHVDAWpkrU4c,11493
|
|
@@ -3473,7 +3473,7 @@ wagtail/snippets/tests/test_bulk_actions/test_bulk_delete.py,sha256=h19bHzxx0FiP
|
|
|
3473
3473
|
wagtail/snippets/tests/test_bulk_actions/test_custom_models.py,sha256=ymcv9FcRzaqA9P_QXIkCLDS2SBhV2Kc9jDrw1W51LZo,2156
|
|
3474
3474
|
wagtail/snippets/views/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3475
3475
|
wagtail/snippets/views/chooser.py,sha256=Yhr19rpjifwu3YWE0k1ULZkcXWVKXP0mXc4o-ul7f88,2178
|
|
3476
|
-
wagtail/snippets/views/snippets.py,sha256=
|
|
3476
|
+
wagtail/snippets/views/snippets.py,sha256=mTCmGAkZ7BAtIg4Zb4iFesIChWMMa9w672iGDWVfWNQ,47138
|
|
3477
3477
|
wagtail/templates/wagtailcore/login.html,sha256=OFcM7lpacqi4vTcHAwmh6-FjYl2fWEKKMJsqPYWhinM,998
|
|
3478
3478
|
wagtail/templates/wagtailcore/page.html,sha256=731rpIL3MbL3oNEEIzrwQ-a7KgJITGnyCRJa5K8EuU4,343
|
|
3479
3479
|
wagtail/templates/wagtailcore/password_required.html,sha256=cHsx0GRU8EaXeEyR_jigoKuf4gzS1leEuhFmoU4wmUM,726
|
|
@@ -3923,9 +3923,9 @@ wagtail/utils/urlpatterns.py,sha256=RDhVScxdm-RV4HSMjWElyrbEoTPsXu841_SKMgoFKtY,
|
|
|
3923
3923
|
wagtail/utils/utils.py,sha256=UALGn0KOyqi5ZoXOozWX99ZPUsVZP51ET8d7sZ1jlm0,430
|
|
3924
3924
|
wagtail/utils/version.py,sha256=40WGMIy8nSPQJFF01p7c38L444SexH2Cb-bQmR8ztXg,1478
|
|
3925
3925
|
wagtail/utils/widgets.py,sha256=ibAvxHCjNw06bMlTD7wvrwmGEMNS3NzrnSKREGfPF44,1775
|
|
3926
|
-
wagtail-6.0.
|
|
3927
|
-
wagtail-6.0.
|
|
3928
|
-
wagtail-6.0.
|
|
3929
|
-
wagtail-6.0.
|
|
3930
|
-
wagtail-6.0.
|
|
3931
|
-
wagtail-6.0.
|
|
3926
|
+
wagtail-6.0.4.dist-info/LICENSE,sha256=0aiL7_RJ2YkOjscmRI7opwmuURrY6h8MR0B24nrdRQU,1512
|
|
3927
|
+
wagtail-6.0.4.dist-info/METADATA,sha256=6Ef-2tXIk5xrp9ARl7sYEZGKSMc_jkQZl_d3dRMtl2g,3797
|
|
3928
|
+
wagtail-6.0.4.dist-info/WHEEL,sha256=2wepM1nk4DS4eFpYrW1TTqPcoGNfHhhO_i5m4cOimbo,92
|
|
3929
|
+
wagtail-6.0.4.dist-info/entry_points.txt,sha256=R14Z0xKoufNcDaku0EWDKM-K8J4ap0EImO8C-df8HVM,53
|
|
3930
|
+
wagtail-6.0.4.dist-info/top_level.txt,sha256=zcKgvuRTi0gSgVzJ1qMoERCwhQ_i0n9bkyxza3oh9as,8
|
|
3931
|
+
wagtail-6.0.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|