Skip to content

Commit

Permalink
Compatible Wagtail 6.0.1, Django 5.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rense committed Feb 29, 2024
1 parent aa6cab8 commit 170a947
Show file tree
Hide file tree
Showing 20 changed files with 56 additions and 65 deletions.
2 changes: 1 addition & 1 deletion example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.black]
line-length=99
target-version=["py39"]
target-version=["py310"]
exclude = '''
/(
\.git
Expand Down
2 changes: 1 addition & 1 deletion readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
python:
version: 3.5
version: 3.10
pip_install: true
requirements_file: docs/requirements.txt
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# The app itself
-e .

Django>=3.2
Django>=5
mock
psycopg2-binary

Expand Down
15 changes: 6 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
Expand Down Expand Up @@ -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",
],
)
24 changes: 12 additions & 12 deletions tests/blocks/test_form_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,48 @@ def test_render(self):
[
"<h2>Basic Form</h2>",
'<form action="." enctype="multipart/form-data" method="post" novalidate>',
'<input type="hidden" name="hidden" id="id_hidden" />',
'<input aria-describedby="id_hidden_helptext" type="hidden" name="hidden" id="id_hidden" />',
'<input id="id_form_id" name="form_id" type="hidden" value="%s">' % self.form.pk,
'<input id="id_form_reference" name="form_reference" type="hidden" value="some-ref">',
'<div class="field-row">'
'<label for="id_singleline">singleline</label>'
'<input type="text" name="singleline" required id="id_singleline" />'
'<input aria-describedby="id_singleline_helptext" type="text" name="singleline" required id="id_singleline" />'
'<p class="help-text">Help</p>'
"</div>",
'<div class="field-row">'
'<label for="id_multiline">multiline</label>'
'<textarea name="multiline" cols="40" rows="10" required id="id_multiline">'
'<textarea aria-describedby="id_multiline_helptext" name="multiline" cols="40" rows="10" required id="id_multiline">'
"</textarea>"
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_date">date</label>'
'<input type="text" name="date" value="" required id="id_date" />'
'<input aria-describedby="id_date_helptext" type="text" name="date" value="" required id="id_date" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_datetime">datetime</label>'
'<input type="text" name="datetime" value="" required id="id_datetime" />'
'<input aria-describedby="id_datetime_helptext" type="text" name="datetime" value="" required id="id_datetime" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_email">email</label>'
'<input type="email" maxlength="320" name="email" required id="id_email" />'
'<input aria-describedby="id_email_helptext" type="email" maxlength="320" name="email" required id="id_email" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_url">url</label>'
'<input type="url" name="url" required id="id_url" />'
'<input aria-describedby="id_url_helptext" type="url" name="url" required id="id_url" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_number">number</label>'
'<input type="number" name="number" step="any" required id="id_number" />'
'<input aria-describedby="id_number_helptext" type="number" name="number" step="any" required id="id_number" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_dropdown">dropdown</label>'
'<select name="dropdown" id="id_dropdown">'
'<select aria-describedby="id_dropdown_helptext" name="dropdown" id="id_dropdown">'
'<option value="Option 1">Option 1</option>'
'<option value="Option 2">Option 2</option>'
'<option value="Option 3">Option 3</option></select>'
Expand Down Expand Up @@ -103,17 +103,17 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_checkbox">checkbox</label>'
'<input type="checkbox" name="checkbox" required id="id_checkbox" />'
'<input aria-describedby="id_checkbox_helptext" type="checkbox" name="checkbox" required id="id_checkbox" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_singlefile">singlefile</label>'
'<input type="file" name="singlefile" required id="id_singlefile" />'
'<input aria-describedby="id_singlefile_helptext" type="file" name="singlefile" required id="id_singlefile" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input aria-describedby="id_multifile_helptext" type="file" name="multifile" multiple required id="id_multifile" />'
'<p class="help-text">Help</p>'
"</div>"
'<input type="submit" value="Submit">'
Expand Down
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"wagtail.contrib.redirects",
"wagtail.contrib.forms",
"wagtail.sites",
"wagtail.contrib.modeladmin",
"wagtail_modeladmin",
"wagtail.contrib.settings",
"taggit",
"wagtailstreamforms",
Expand Down
24 changes: 12 additions & 12 deletions tests/templatetags/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,48 +24,48 @@ def test_render(self):
[
"<h2>Basic Form</h2>",
'<form action="." enctype="multipart/form-data" method="post" novalidate>',
'<input type="hidden" name="hidden" id="id_hidden" />',
'<input aria-describedby="id_hidden_helptext" type="hidden" name="hidden" id="id_hidden" />',
'<input id="id_form_id" name="form_id" type="hidden" value="%s">' % self.form.pk,
'<input id="id_form_reference" name="form_reference" type="hidden" value="some-ref">',
'<div class="field-row">'
'<label for="id_singleline">singleline</label>'
'<input type="text" name="singleline" required id="id_singleline" />'
'<input aria-describedby="id_singleline_helptext" type="text" name="singleline" required id="id_singleline" />'
'<p class="help-text">Help</p>'
"</div>",
'<div class="field-row">'
'<label for="id_multiline">multiline</label>'
'<textarea name="multiline" cols="40" rows="10" required id="id_multiline">'
'<textarea aria-describedby="id_multiline_helptext" name="multiline" cols="40" rows="10" required id="id_multiline">'
"</textarea>"
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_date">date</label>'
'<input type="text" name="date" value="" required id="id_date" />'
'<input aria-describedby="id_date_helptext" type="text" name="date" value="" required id="id_date" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_datetime">datetime</label>'
'<input type="text" name="datetime" value="" required id="id_datetime" />'
'<input aria-describedby="id_datetime_helptext" type="text" name="datetime" value="" required id="id_datetime" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_email">email</label>'
'<input type="email" maxlength="320" name="email" required id="id_email" />'
'<input aria-describedby="id_email_helptext" type="email" maxlength="320" name="email" required id="id_email" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_url">url</label>'
'<input type="url" name="url" required id="id_url" />'
'<input aria-describedby="id_url_helptext" type="url" name="url" required id="id_url" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_number">number</label>'
'<input type="number" name="number" step="any" required id="id_number" />'
'<input aria-describedby="id_number_helptext" type="number" name="number" step="any" required id="id_number" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_dropdown">dropdown</label>'
'<select name="dropdown" id="id_dropdown">'
'<select aria-describedby="id_dropdown_helptext" name="dropdown" id="id_dropdown">'
'<option value="Option 1">Option 1</option>'
'<option value="Option 2">Option 2</option>'
'<option value="Option 3">Option 3</option></select>'
Expand Down Expand Up @@ -101,17 +101,17 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_checkbox">checkbox</label>'
'<input type="checkbox" name="checkbox" required id="id_checkbox" />'
'<input aria-describedby="id_checkbox_helptext" type="checkbox" name="checkbox" required id="id_checkbox" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_singlefile">singlefile</label>'
'<input type="file" name="singlefile" required id="id_singlefile" />'
'<input aria-describedby="id_singlefile_helptext" type="file" name="singlefile" required id="id_singlefile" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input aria-describedby="id_multifile_helptext" type="file" name="multifile" multiple required id="id_multifile" />'
'<p class="help-text">Help</p>'
"</div>"
'<input type="submit" value="Submit">'
Expand Down
2 changes: 1 addition & 1 deletion tests/urls.py
Original file line number Diff line number Diff line change
@@ -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),
Expand Down
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
[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

[testenv]
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

Expand Down
2 changes: 1 addition & 1 deletion wagtailstreamforms/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"singlefile",
"multifile",
),
"FORM_TEMPLATES": (("streamforms/form_block.html", "Default Form Template"),),
"FORM_TEMPLATES": [("streamforms/form_block.html", "Default Form Template")],
}


Expand Down
3 changes: 1 addition & 2 deletions wagtailstreamforms/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion wagtailstreamforms/migrations/0003_alter_form_fields.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<ul class="fields">
{% block visible_fields %}
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
{% include "wagtailadmin/shared/field.html" %}
{% endfor %}
{% endblock %}
<li>
Expand Down
2 changes: 1 addition & 1 deletion wagtailstreamforms/templates/streamforms/confirm_copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ul class="fields">
{% block visible_fields %}
{% for field in form.visible_fields %}
{% include "wagtailadmin/shared/field_as_li.html" %}
{% include "wagtailadmin/shared/field.html" %}
{% endfor %}
{% endblock %}
<li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ <h1 class="icon icon-form">
<div class="col search-bar">
<ul class="fields row rowflush">
{% for field in filter_form %}
{% include "wagtailadmin/shared/field_as_li.html" with field=field field_classes="field-small" li_classes="col4" %}
{% include "wagtailadmin/shared/field.html" with field=field field_classes="field-small" li_classes="col4" %}
{% endfor %}
<li class="submit col2">
<button name="action" value="filter" class="button button-filter">{% trans 'Filter' %}</button>
Expand Down
7 changes: 2 additions & 5 deletions wagtailstreamforms/views/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@
from django.core.exceptions import PermissionDenied
from django.http import HttpResponseRedirect
from django.utils.translation import gettext_lazy as _
from django.views.generic.detail import (
BaseDetailView,
SingleObjectTemplateResponseMixin,
)
from wagtail.contrib.modeladmin.helpers import PermissionHelper
from django.views.generic.detail import BaseDetailView, SingleObjectTemplateResponseMixin
from wagtail_modeladmin.helpers import PermissionHelper

from wagtailstreamforms.models import Form
from wagtailstreamforms.wagtail_hooks import FormURLHelper
Expand Down
2 changes: 1 addition & 1 deletion wagtailstreamforms/views/submission_delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from django.urls import reverse
from django.utils.translation import ngettext
from django.views.generic import DeleteView
from wagtail.contrib.modeladmin.helpers import PermissionHelper
from wagtail_modeladmin.helpers import PermissionHelper

from wagtailstreamforms.models import Form

Expand Down
2 changes: 1 addition & 1 deletion wagtailstreamforms/views/submission_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from django.utils.translation import gettext as _
from django.views.generic import ListView
from django.views.generic.detail import SingleObjectMixin
from wagtail.contrib.modeladmin.helpers import PermissionHelper
from wagtail_modeladmin.helpers import PermissionHelper

from wagtailstreamforms import hooks
from wagtailstreamforms.forms import SelectDateForm
Expand Down
13 changes: 4 additions & 9 deletions wagtailstreamforms/wagtail_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,11 @@
from django.utils.translation import gettext_lazy as _
from generic_chooser.views import ModelChooserViewSet
from generic_chooser.widgets import AdminChooser
from wagtail.admin import messages as wagtail_messages
from wagtail.contrib.modeladmin.helpers import AdminURLHelper, ButtonHelper
from wagtail.contrib.modeladmin.options import ModelAdmin, modeladmin_register
from wagtail.contrib.modeladmin.views import (
CreateView,
DeleteView,
EditView,
InspectView,
)
from wagtail import hooks
from wagtail.admin import messages as wagtail_messages
from wagtail_modeladmin.helpers import AdminURLHelper, ButtonHelper
from wagtail_modeladmin.options import ModelAdmin, modeladmin_register
from wagtail_modeladmin.views import CreateView, DeleteView, EditView, InspectView

from wagtailstreamforms import hooks as form_hooks
from wagtailstreamforms.conf import get_setting
Expand Down

0 comments on commit 170a947

Please sign in to comment.