From 170a947e9d30ed6633b16e389bbecc58d6aba352 Mon Sep 17 00:00:00 2001 From: rense Date: Thu, 29 Feb 2024 20:29:16 +0100 Subject: [PATCH 1/8] Compatible Wagtail 6.0.1, Django 5.0.2 --- example/settings.py | 2 +- pyproject.toml | 2 +- readthedocs.yml | 2 +- requirements.txt | 2 +- setup.py | 15 +++++------- tests/blocks/test_form_block.py | 24 +++++++++---------- tests/settings.py | 2 +- tests/templatetags/test_form.py | 24 +++++++++---------- tests/urls.py | 2 +- tox.ini | 8 ++++--- wagtailstreamforms/conf.py | 2 +- wagtailstreamforms/migrations/0001_initial.py | 3 +-- .../migrations/0003_alter_form_fields.py | 3 ++- .../streamforms/advanced_settings.html | 2 +- .../templates/streamforms/confirm_copy.html | 2 +- .../streamforms/index_submissions.html | 2 +- wagtailstreamforms/views/copy.py | 7 ++---- wagtailstreamforms/views/submission_delete.py | 2 +- wagtailstreamforms/views/submission_list.py | 2 +- wagtailstreamforms/wagtail_hooks.py | 13 ++++------ 20 files changed, 56 insertions(+), 65 deletions(-) diff --git a/example/settings.py b/example/settings.py index 56241b04..dbe855e9 100644 --- a/example/settings.py +++ b/example/settings.py @@ -37,7 +37,7 @@ 'wagtail.search', 'wagtail.contrib.redirects', 'wagtail.sites', - 'wagtail.contrib.modeladmin', + 'wagtail_modeladmin', 'wagtail.contrib.postgres_search', 'wagtail.contrib.settings', 'wagtail.contrib.search_promotions', diff --git a/pyproject.toml b/pyproject.toml index c8c642a5..7d5e067d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length=99 -target-version=["py39"] +target-version=["py310"] exclude = ''' /( \.git diff --git a/readthedocs.yml b/readthedocs.yml index 06897971..59a3922f 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -1,5 +1,5 @@ --- python: - version: 3.5 + version: 3.10 pip_install: true requirements_file: docs/requirements.txt diff --git a/requirements.txt b/requirements.txt index 1f7ad04c..58f87345 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ # The app itself -e . -Django>=3.2 +Django>=5 mock psycopg2-binary diff --git a/setup.py b/setup.py index 87ec759e..c6558487 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ install_requires = [ - "wagtail>=4.1,<5.3", + "wagtail>5.2,<=6.0.1", "Unidecode>=0.04.14,<2.0", "wagtail-generic-chooser>=0.5.0,<0.7", ] @@ -61,17 +61,14 @@ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Framework :: Django", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4", - "Framework :: Django :: 4.0", - "Framework :: Django :: 4.1", - "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", "Framework :: Wagtail", - "Framework :: Wagtail :: 4", + "Framework :: Wagtail :: 5", + "Framework :: Wagtail :: 6", "Topic :: Internet :: WWW/HTTP :: Site Management", ], ) diff --git a/tests/blocks/test_form_block.py b/tests/blocks/test_form_block.py index c1b72d7f..7e88cc84 100644 --- a/tests/blocks/test_form_block.py +++ b/tests/blocks/test_form_block.py @@ -26,48 +26,48 @@ def test_render(self): [ "

Basic Form

", '
', - '', + '', '' % self.form.pk, '', '
' '' - '' + '' '

Help

' "
", '
' '' - '" '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' '' '' '' @@ -103,17 +103,17 @@ def test_render(self): "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '' diff --git a/tests/settings.py b/tests/settings.py index ca1423f5..ae61af2c 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -25,7 +25,7 @@ "wagtail.contrib.redirects", "wagtail.contrib.forms", "wagtail.sites", - "wagtail.contrib.modeladmin", + "wagtail_modeladmin", "wagtail.contrib.settings", "taggit", "wagtailstreamforms", diff --git a/tests/templatetags/test_form.py b/tests/templatetags/test_form.py index 97b3bde5..645da863 100644 --- a/tests/templatetags/test_form.py +++ b/tests/templatetags/test_form.py @@ -24,48 +24,48 @@ def test_render(self): [ "

Basic Form

", '', - '', + '', '' % self.form.pk, '', '
' '' - '' + '' '

Help

' "
", '
' '' - '" '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' '' '' '' @@ -101,17 +101,17 @@ def test_render(self): "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '
' '' - '' + '' '

Help

' "
" '' diff --git a/tests/urls.py b/tests/urls.py index 10877f70..225f73f6 100644 --- a/tests/urls.py +++ b/tests/urls.py @@ -1,7 +1,7 @@ from django.contrib import admin from django.urls import include, re_path -from wagtail.admin import urls as wagtailadmin_urls from wagtail import urls as wagtail_urls +from wagtail.admin import urls as wagtailadmin_urls urlpatterns = [ re_path(r"^admin/", admin.site.urls), diff --git a/tox.ini b/tox.ini index 44273018..3930d294 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,11 @@ [tox] envlist = flake8 - py{311,312}-dj{41}-wt{41,50,51,52} + py{310,311,312}-dj{50}-wt{50,51,52,60} [gh-actions] python = + "3.10": py310 "3.11": py311 "3.12": py312 @@ -12,16 +13,17 @@ python = deps = coverage mock - dj41: Django>=4.1,<4.2 - wt41: wagtail>=4.1,<4.2 + dj50: Django>=5.0,<5.1 wt50: wagtail>=5.0,<5.1 wt51: wagtail>=5.1,<5.2 wt52: wagtail>=5.2,<5.3 + wt60: wagtail>=6.0,<6.1 commands = coverage run manage.py test basepython = + py310: python3.10 py311: python3.11 py312: python3.12 diff --git a/wagtailstreamforms/conf.py b/wagtailstreamforms/conf.py index 245bd5b5..551dd212 100644 --- a/wagtailstreamforms/conf.py +++ b/wagtailstreamforms/conf.py @@ -24,7 +24,7 @@ "singlefile", "multifile", ), - "FORM_TEMPLATES": (("streamforms/form_block.html", "Default Form Template"),), + "FORM_TEMPLATES": [("streamforms/form_block.html", "Default Form Template")], } diff --git a/wagtailstreamforms/migrations/0001_initial.py b/wagtailstreamforms/migrations/0001_initial.py index 01eba326..90151c1e 100644 --- a/wagtailstreamforms/migrations/0001_initial.py +++ b/wagtailstreamforms/migrations/0001_initial.py @@ -1,9 +1,8 @@ # Generated by Django 2.0.5 on 2018-05-30 23:03 import django.db.models.deletion -from wagtail import blocks - from django.db import migrations, models +from wagtail import blocks import wagtailstreamforms.conf import wagtailstreamforms.fields diff --git a/wagtailstreamforms/migrations/0003_alter_form_fields.py b/wagtailstreamforms/migrations/0003_alter_form_fields.py index cb9e2318..a486033c 100644 --- a/wagtailstreamforms/migrations/0003_alter_form_fields.py +++ b/wagtailstreamforms/migrations/0003_alter_form_fields.py @@ -1,7 +1,8 @@ # Generated by Django 4.1.8 on 2023-04-14 05:21 -from django.db import migrations import wagtail.blocks +from django.db import migrations + import wagtailstreamforms.streamfield diff --git a/wagtailstreamforms/templates/streamforms/advanced_settings.html b/wagtailstreamforms/templates/streamforms/advanced_settings.html index a90254c5..e3f81f28 100644 --- a/wagtailstreamforms/templates/streamforms/advanced_settings.html +++ b/wagtailstreamforms/templates/streamforms/advanced_settings.html @@ -13,7 +13,7 @@