From 2e805dc58f44cfe9fd3ba9bffc8291c3d7054e4e Mon Sep 17 00:00:00 2001
From: Paul J Stevens
Date: Fri, 1 Dec 2023 15:11:37 +0100
Subject: [PATCH] wagtail 5.2 support
drop python 3.8
add python 3.11 and 3.12
add wagtail 4.2, 5.0, 5.1, 5.2
---
setup.py | 6 +-
tests/blocks/test_form_block.py | 5 +-
tests/settings.py | 1 +
tests/templatetags/test_form.py | 4 +-
tox.ini | 19 ++-
wagtailstreamforms/migrations/0001_initial.py | 145 +++++++++---------
6 files changed, 95 insertions(+), 85 deletions(-)
diff --git a/setup.py b/setup.py
index 4fc26779..87ec759e 100644
--- a/setup.py
+++ b/setup.py
@@ -9,6 +9,8 @@
tests_require = [
"mock==4.0.2",
+ "pytest-django==4.7.0",
+ "pytest==7.3.2",
# Linting
"isort[pyproject]==4.3.21",
"flake8==3.7.9",
@@ -18,9 +20,9 @@
install_requires = [
- "wagtail>=4.1,<4.3",
+ "wagtail>=4.1,<5.3",
"Unidecode>=0.04.14,<2.0",
- "wagtail-generic-chooser>=0.5.0,<0.6",
+ "wagtail-generic-chooser>=0.5.0,<0.7",
]
documentation_extras = [
diff --git a/tests/blocks/test_form_block.py b/tests/blocks/test_form_block.py
index f0b463a2..abc07d26 100644
--- a/tests/blocks/test_form_block.py
+++ b/tests/blocks/test_form_block.py
@@ -13,6 +13,7 @@ def setUp(self):
self.form = Form.objects.get(pk=1)
def test_render(self):
+ self.maxDiff = None
block = WagtailFormBlock()
html = block.render(
@@ -53,7 +54,7 @@ def test_render(self):
""
''
'
'
- '
'
+ '
'
'
Help
'
"
"
''
@@ -153,7 +154,7 @@ def test_render(self):
"
"
''
'
'
- '
'
+ '
'
'
Help
'
"
"
''
diff --git a/tests/settings.py b/tests/settings.py
index 6fbb8f25..ca1423f5 100644
--- a/tests/settings.py
+++ b/tests/settings.py
@@ -71,3 +71,4 @@
LOGIN_URL = reverse_lazy("admin:login")
WAGTAILSTREAMFORMS_ADVANCED_SETTINGS_MODEL = "tests.ValidFormSettingsModel"
+DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
diff --git a/tests/templatetags/test_form.py b/tests/templatetags/test_form.py
index 7c9414b2..be7038e2 100644
--- a/tests/templatetags/test_form.py
+++ b/tests/templatetags/test_form.py
@@ -52,7 +52,7 @@ def test_render(self):
"
"
''
'
'
- '
'
+ '
'
'
Help
'
"
"
''
@@ -152,7 +152,7 @@ def test_render(self):
"
"
''
'
'
- '
'
+ '
'
'
Help
'
"
"
''
diff --git a/tox.ini b/tox.ini
index d87dd525..0dff3791 100644
--- a/tox.ini
+++ b/tox.ini
@@ -1,13 +1,14 @@
[tox]
envlist =
flake8
- py{38,39,310}-dj{32,40,41}-wt{41,42}
+ py{39,310,311,312}-dj{32,40,41}-wt{41,42,50,51,52}
[gh-actions]
python =
- 3.8: py38
3.9: py39
"3.10": py310
+ "3.11": py311
+ "3.12": py312
[testenv]
deps =
@@ -18,14 +19,18 @@ deps =
dj41: Django>=4.1,<4.2
wt41: wagtail>=4.1,<4.2
wt42: wagtail>=4.2,<4.3
+ wt50: wagtail>=5.0,<5.1
+ wt51: wagtail>=5.1,<5.2
+ wt52: wagtail>=5.2,<5.3
commands =
coverage run manage.py test
basepython =
- py38: python3.8
py39: python3.9
py310: python3.10
+ py311: python3.11
+ py312: python3.12
setenv =
DJANGO_SETTINGS_MODULE=tests.settings
@@ -35,7 +40,7 @@ setenv =
passenv = TOX_*
[testenv:wagtaildev]
-basepython = python3.8
+basepython = python3.10
install_command = pip install -e ".[test]" -U {opts} {packages}
deps =
git+https://github.com/wagtail/wagtail.git@master
@@ -47,7 +52,7 @@ commands =
ignore_errors = True
[testenv:flake8]
-basepython = python3.8
+basepython = python3.10
deps = flake8
commands = flake8 wagtailstreamforms
@@ -65,7 +70,7 @@ exclude =
max-line-length = 120
[testenv:coverage-report]
-basepython = python3.8
+basepython = python3.10
deps = coverage[toml]
skip_install = true
commands =
@@ -74,7 +79,7 @@ commands =
coverage report
[testenv:format]
-basepython = python3.8
+basepython = python3.10
deps =
isort
black
diff --git a/wagtailstreamforms/migrations/0001_initial.py b/wagtailstreamforms/migrations/0001_initial.py
index f7e29279..01eba326 100644
--- a/wagtailstreamforms/migrations/0001_initial.py
+++ b/wagtailstreamforms/migrations/0001_initial.py
@@ -1,7 +1,8 @@
# Generated by Django 2.0.5 on 2018-05-30 23:03
import django.db.models.deletion
-import wagtail.core.blocks
+from wagtail import blocks
+
from django.db import migrations, models
import wagtailstreamforms.conf
@@ -52,24 +53,24 @@ class Migration(migrations.Migration):
[
(
"singleline",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -80,24 +81,24 @@ class Migration(migrations.Migration):
),
(
"multiline",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -108,24 +109,24 @@ class Migration(migrations.Migration):
),
(
"date",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -136,24 +137,24 @@ class Migration(migrations.Migration):
),
(
"datetime",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -164,24 +165,24 @@ class Migration(migrations.Migration):
),
(
"email",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -192,24 +193,24 @@ class Migration(migrations.Migration):
),
(
"url",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -220,24 +221,24 @@ class Migration(migrations.Migration):
),
(
"number",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -248,31 +249,31 @@ class Migration(migrations.Migration):
),
(
"dropdown",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"empty_label",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"choices",
- wagtail.core.blocks.ListBlock(
- wagtail.core.blocks.CharBlock(
+ blocks.ListBlock(
+ blocks.CharBlock(
label="Option"
)
),
@@ -284,25 +285,25 @@ class Migration(migrations.Migration):
),
(
"radio",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"choices",
- wagtail.core.blocks.ListBlock(
- wagtail.core.blocks.CharBlock(
+ blocks.ListBlock(
+ blocks.CharBlock(
label="Option"
)
),
@@ -314,25 +315,25 @@ class Migration(migrations.Migration):
),
(
"checkboxes",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"choices",
- wagtail.core.blocks.ListBlock(
- wagtail.core.blocks.CharBlock(
+ blocks.ListBlock(
+ blocks.CharBlock(
label="Option"
)
),
@@ -344,18 +345,18 @@ class Migration(migrations.Migration):
),
(
"checkbox",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
@@ -366,24 +367,24 @@ class Migration(migrations.Migration):
),
(
"hidden",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
(
"default_value",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
@@ -394,18 +395,18 @@ class Migration(migrations.Migration):
),
(
"singlefile",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),
@@ -416,18 +417,18 @@ class Migration(migrations.Migration):
),
(
"multifile",
- wagtail.core.blocks.StructBlock(
+ blocks.StructBlock(
[
- ("label", wagtail.core.blocks.CharBlock()),
+ ("label", blocks.CharBlock()),
(
"help_text",
- wagtail.core.blocks.CharBlock(
+ blocks.CharBlock(
required=False
),
),
(
"required",
- wagtail.core.blocks.BooleanBlock(
+ blocks.BooleanBlock(
required=False
),
),