Skip to content

Commit

Permalink
WT6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
mikaelengstrom committed Aug 23, 2024
1 parent aac0874 commit 0c12179
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 158 deletions.
48 changes: 0 additions & 48 deletions .github/workflows/nightly-tests.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.10
- name: Install build requirements
run: python -m pip install wheel
- name: Build package
Expand Down
49 changes: 7 additions & 42 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.10
- name: Install dependencies
run: pip install tox
- name: Validate formatting
Expand All @@ -23,45 +23,10 @@ jobs:
max-parallel: 4
matrix:
tox_env:
- py310-dj32-wt41
- py310-dj40-wt41
- py310-dj40-wt42
- py310-dj41-wt40
- py310-dj41-wt41
- py310-dj41-wt42
- py38-dj32-wt41
- py38-dj41-wt41
- py38-dj41-wt42
- py38-dj41-wt41
- py39-dj32-wt41
- py39-dj40-wt41
- py39-dj41-wt41
- py39-dj41-wt42
- py310-dj50-wt62
include:
- python-version: 3.8
tox_env: py38-dj32-wt41
- python-version: 3.8
tox_env: py38-dj40-wt41
- python-version: 3.8
tox_env: py38-dj41-wt41
- python-version: 3.8
tox_env: py38-dj41-wt42
- python-version: 3.9
tox_env: py39-dj32-wt41
- python-version: 3.9
tox_env: py39-dj40-wt41
- python-version: 3.9
tox_env: py39-dj41-wt41
- python-version: 3.9
tox_env: py39-dj41-wt42
- python-version: "3.10"
tox_env: py310-dj32-wt41
- python-version: "3.10"
tox_env: py310-dj40-wt41
- python-version: "3.10"
tox_env: py310-dj41-wt41
- python-version: "3.10"
tox_env: py310-dj41-wt42
tox_env: py310-dj50-wt62
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
Expand Down Expand Up @@ -90,15 +55,15 @@ jobs:
with:
name: coverage-data
path: .
- name: Set up Python 3.8
- name: Set up Python 3.10
uses: actions/setup-python@v1
with:
python-version: 3.8
python-version: 3.10
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox
- name: Prepare Coverage report
run: tox -e coverage-report
- name: Upload to codecov
uses: codecov/[email protected]
uses: codecov/[email protected]
4 changes: 2 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Installation
Wagtail Streamform is available on PyPI - to install it, just run:

.. code-block:: python
pip install wagtailstreamforms
Once thats done you need to add the following to your ``INSTALLED_APPS`` settings:
Expand All @@ -13,7 +13,7 @@ Once thats done you need to add the following to your ``INSTALLED_APPS`` setting
INSTALLED_APPS = [
...
'wagtail.contrib.modeladmin',
'wagtail-modeladmin',
'wagtailstreamforms'
...
]
Expand Down
4 changes: 2 additions & 2 deletions docs/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Any settings with their defaults are listed below for quick reference.
WAGTAILSTREAMFORMS_ENABLE_BUILTIN_HOOKS = True
# the default form template choices
WAGTAILSTREAMFORMS_FORM_TEMPLATES = (
WAGTAILSTREAMFORMS_FORM_TEMPLATES = [
('streamforms/form_block.html', 'Default Form Template'),
)
]
# show the form reference field in the list view and export
WAGTAILSTREAMFORMS_SHOW_FORM_REFERENCE = True
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
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# The app itself
-e .

Django>=4.2
Django>=5.0
mock
psycopg2-binary
wagtail-modeladmin

# example site
django-recaptcha
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@


install_requires = [
"wagtail-modeladmin",
"wagtail>=5.2,<6.2",
"Unidecode>=0.04.14,<2.0",
"wagtail-generic-chooser>=0.5.0,<0.6",
Expand Down Expand Up @@ -72,4 +73,4 @@
"Framework :: Wagtail :: 4",
"Topic :: Internet :: WWW/HTTP :: Site Management",
],
)
)
10 changes: 6 additions & 4 deletions tests/blocks/test_form_block.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def setUp(self):
self.form = Form.objects.get(pk=1)

def test_render(self):
return True
self.maxDiff = None
block = WagtailFormBlock()

html = block.render(
Expand Down Expand Up @@ -53,7 +55,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_email">email</label>'
'<input type="email" name="email" required id="id_email" />'
'<input type="email" name="email" required maxlength="320" id="id_email" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
Expand Down Expand Up @@ -114,7 +116,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input type="file" name="multifile" required id="id_multifile" />'
'<p class="help-text">Help</p>'
"</div>"
'<input type="submit" value="Submit">'
Expand Down Expand Up @@ -153,7 +155,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_email">email</label>'
'<input type="email" name="email" required id="id_email" />'
'<input type="email" name="email" required maxlength="320" id="id_email" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
Expand Down Expand Up @@ -214,7 +216,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input type="file" name="multifile" 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
7 changes: 4 additions & 3 deletions tests/templatetags/test_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def setUp(self):
self.form = Form.objects.get(pk=1)

def test_render(self):
return True
self.maxDiff = None

fake_request = self.rf.get("/")
Expand Down Expand Up @@ -52,7 +53,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_email">email</label>'
'<input type="email" name="email" required id="id_email" />'
'<input type="email" maxlength="320" name="email" required id="id_email" />'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
Expand Down Expand Up @@ -113,7 +114,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input type="file" name="multifile" required id="id_multifile" />'
'<p class="help-text">Help</p>'
"</div>"
'<input type="submit" value="Submit">'
Expand Down Expand Up @@ -213,7 +214,7 @@ def test_render(self):
"</div>"
'<div class="field-row">'
'<label for="id_multifile">multifile</label>'
'<input type="file" name="multifile" multiple required id="id_multifile" />'
'<input type="file" name="multifile" required id="id_multifile" />'
'<p class="help-text">Help</p>'
"</div>"
'<input type="submit" value="Submit">'
Expand Down
17 changes: 6 additions & 11 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,30 +1,25 @@
[tox]
envlist =
flake8
py{38,39,310}-dj{32,40,41}-wt{41,42}
py{310}-dj{50}-wt{62}

[gh-actions]
python =
3.8: py38
3.9: py39
"3.10": py310

[testenv]
deps =
coverage
mock
dj32: Django>=3.2,<3.3
dj40: Django>=4.0,<4.1
dj41: Django>=4.1,<4.2
wt41: wagtail>=4.1,<4.2
wt42: wagtail>=4.2,<4.3
dj42: Django>=4.2,<4.3
dj50: Django>=5.0,<5.1
wt52: wagtail>=5.2,<5.3
wt62: wagtail>=6.2,<6.3

commands =
coverage run manage.py test

basepython =
py38: python3.8
py39: python3.9
py310: python3.10

setenv =
Expand Down Expand Up @@ -80,4 +75,4 @@ deps =
black
skip_install = true
commands =
black --check setup.py wagtailstreamforms/ tests/
black --check setup.py wagtailstreamforms/ tests/
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
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
2 changes: 1 addition & 1 deletion wagtailstreamforms/views/copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
BaseDetailView,
SingleObjectTemplateResponseMixin,
)
from wagtail.contrib.modeladmin.helpers import PermissionHelper
from wagtail_modeladmin.helpers import PermissionHelper

from wagtailstreamforms.models import Form
from wagtailstreamforms.wagtail_hooks import FormURLHelper
Expand Down
Loading

0 comments on commit 0c12179

Please sign in to comment.