Browse Source

Add support for wagtail 6 and 6.1 (#624)

Update version support to Wagtail 6, along with matching wagtail Django
versions

Closes #622

---------

Co-authored-by: Vince Salvino <salvino@coderedcorp.com>
Jeremy Childers 10 months ago
parent
commit
7bb842b06e
3 changed files with 25 additions and 23 deletions
  1. 13 13
      azure-pipelines.yml
  2. 4 2
      coderedcms/wagtail_hooks.py
  3. 8 8
      setup.py

+ 13 - 13
azure-pipelines.yml

@@ -31,29 +31,29 @@ stages:
       vmImage: 'ubuntu-latest'
     strategy:
       matrix:
-        py3.8_wag5.0:
+        py3.8:
           PYTHON_VERSION: '3.8'
-          WAGTAIL_VERSION: '5.0.*'
+          WAGTAIL_VERSION: '6.0.*'
           TEMPLATE: 'basic'
-        py3.9_wag5.0:
+        py3.9:
           PYTHON_VERSION: '3.9'
-          WAGTAIL_VERSION: '5.0.*'
+          WAGTAIL_VERSION: '6.0.*'
           TEMPLATE: 'basic'
-        py3.10_wag5.0:
+        py3.10:
           PYTHON_VERSION: '3.10'
-          WAGTAIL_VERSION: '5.0.*'
+          WAGTAIL_VERSION: '6.0.*'
           TEMPLATE: 'basic'
-        py3.11_wag5.1:
+        py3.11:
           PYTHON_VERSION: '3.11'
-          WAGTAIL_VERSION: '5.1.*'
+          WAGTAIL_VERSION: '6.1.*'
           TEMPLATE: 'basic'
-        py3.12_wag5.2_basic:
+        py3.12_basic:
           PYTHON_VERSION: '3.12'
-          WAGTAIL_VERSION: '5.2.*'
+          WAGTAIL_VERSION: '6.1.*'
           TEMPLATE: 'basic'
-        py3.12_wag5.2_pro:
+        py3.12_pro:
           PYTHON_VERSION: '3.12'
-          WAGTAIL_VERSION: '5.2.*'
+          WAGTAIL_VERSION: '6.1.*'
           TEMPLATE: 'pro'
 
     steps:
@@ -153,7 +153,7 @@ stages:
     - task: UsePythonVersion@0
       displayName: 'Use Python version'
       inputs:
-        versionSpec: '3.11'
+        versionSpec: '3.12'
         architecture: 'x64'
 
     - script: python -m pip install -r requirements-ci.txt

+ 4 - 2
coderedcms/wagtail_hooks.py

@@ -9,7 +9,7 @@ from django.utils.translation import gettext_lazy as _
 from wagtail.admin.menu import MenuItem
 from wagtail import hooks
 from wagtail.models import get_page_models
-from wagtail.models import UserPagePermissionsProxy
+from wagtail.permission_policies.pages import PagePermissionPolicy
 from wagtailcache.cache import clear_cache
 
 from coderedcms import __version__
@@ -96,7 +96,9 @@ def crx_forms(user, editable_forms):
         if issubclass(model, (FormMixin, CoderedFormMixin))
     ]
     form_types = list(ContentType.objects.get_for_models(*form_models).values())
-    editable_forms = UserPagePermissionsProxy(user).editable_pages()
+    editable_forms = PagePermissionPolicy().instances_user_has_permission_for(
+        user, "change"
+    )
     editable_forms = editable_forms.filter(content_type__in=form_types)
 
     return editable_forms

+ 8 - 8
setup.py

@@ -33,28 +33,28 @@ setup(
         "Programming Language :: Python :: 3.9",
         "Programming Language :: Python :: 3.10",
         "Programming Language :: Python :: 3.11",
+        "Programming Language :: Python :: 3.12",
         "Programming Language :: Python :: 3 :: Only",
         "Framework :: Django",
-        "Framework :: Django :: 4.1",
         "Framework :: Django :: 4.2",
         "Framework :: Django :: 5.0",
         "Framework :: Wagtail",
-        "Framework :: Wagtail :: 5",
+        "Framework :: Wagtail :: 6",
         "Topic :: Internet :: WWW/HTTP",
         "Topic :: Internet :: WWW/HTTP :: Dynamic Content",
         "Topic :: Internet :: WWW/HTTP :: Site Management",
     ],
     python_requires=">=3.8",
     install_requires=[
-        "beautifulsoup4>=4.8,<4.12",  # should be the same as wagtail
+        "beautifulsoup4>=4.8,<4.13",  # should be the same as wagtail
         "django-eventtools==1.0.*",
-        "django-bootstrap5==23.3",
-        "Django>=4.1,<5.1",  # should be the same as wagtail
+        "django-bootstrap5==23.4",
+        "Django>=4.2,<6.0",  # should be the same as wagtail
         "geocoder==1.38.*",
         "icalendar==5.0.*",
-        "wagtail>=5.0,<6.0",
-        "wagtail-cache>=2.3,<3",
-        "wagtail-seo>=2.4,<3",
+        "wagtail>=6.0,<7.0",
+        "wagtail-cache>=2.4,<3",
+        "wagtail-seo>=2.5,<3",
     ],
     entry_points={
         "console_scripts": ["coderedcms=coderedcms.bin.coderedcms:main"]