Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatible Wagtail 6.3, Django 5.1 #11

Merged
merged 6 commits into from
Mar 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/nightly-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.11
python-version: 3.12
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
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.11
- name: Set up Python 3.12
uses: actions/setup-python@v1
with:
python-version: 3.11
python-version: 3.12
- name: Install build requirements
run: python -m pip install wheel
- name: Build package
Expand Down
53 changes: 12 additions & 41 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: Python Tests

on: [push]
Expand All @@ -7,13 +6,15 @@ jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.11
python-version: "3.12"
- name: Install dependencies
run: pip install tox
run: |
python -m pip install --upgrade pip
pip install tox
- name: Validate formatting
run: tox -e format

Expand All @@ -22,48 +23,18 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ["3.12"]
tox_env:
- py311-dj50-wt60
include:
- python-version: "3.11"
tox_env: py311-dj50-wt60
- py312-dj51-wt63
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
- name: Run tests with tox
run: tox -e ${{ matrix.tox_env }} -- index-url=https://pypi.python.org/simple/
- name: Prepare artifacts
run: mkdir -p .coverage-data && mv .coverage.* .coverage-data/
- uses: actions/upload-artifact@master
with:
name: coverage-data
path: .coverage-data/

coverage:
runs-on: ubuntu-latest
needs: [test]
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@master
with:
name: coverage-data
path: .
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- 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]
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=["py310"]
target-version=["py312"]
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.10
version: 3.12
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
Expand Up @@ -7,4 +7,4 @@ psycopg2-binary

# example site
django-recaptcha
wagtail_modeladmin
wagtail-modeladmin
9 changes: 3 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@


install_requires = [
"wagtail>5.2,<=6.0.1",
"wagtail>6.0,<=6.3",
"Unidecode>=0.04.14,<2.0",
"wagtail-generic-chooser>=0.5.0,<0.7",
"wagtail-modeladmin",
]

documentation_extras = [
Expand Down Expand Up @@ -61,13 +61,10 @@
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Framework :: Django",
"Framework :: Django :: 5.0",
"Framework :: Django :: 5",
"Framework :: Wagtail",
"Framework :: Wagtail :: 5",
"Framework :: Wagtail :: 6",
"Topic :: Internet :: WWW/HTTP :: Site Management",
],
Expand Down
173 changes: 80 additions & 93 deletions tests/blocks/test_form_block.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from django.conf import settings

from wagtailstreamforms.blocks import WagtailFormBlock
from wagtailstreamforms.models import Form

Expand All @@ -25,98 +23,87 @@ def test_render(self):
expected_html = "\n".join(
[
"<h2>Basic Form</h2>",
'<form action="." enctype="multipart/form-data" method="post" novalidate>',
'<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 aria-describedby="id_singleline_helptext" type="text" name="singleline" required id="id_singleline" />'
'<p class="help-text">Help</p>'
'<form enctype="multipart/form-data" action="." method="post" novalidate>',
f'<input type="hidden" name="hidden" id="id_hidden"><input type="hidden" name="form_id" value="{self.form.pk}" id="id_form_id">'
'<input type="hidden" name="form_reference" value="some-ref" id="id_form_reference">',
'<div class="field-row">',
'<label for="id_singleline">singleline</label>',
'<input type="text" name="singleline" required aria-describedby="id_singleline_helptext" 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 aria-describedby="id_multiline_helptext" 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 aria-describedby="id_date_helptext" 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 aria-describedby="id_datetime_helptext" id="id_datetime">',
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">',
'<label for="id_email">email</label>',
'<input type="email" name="email" maxlength="320" required aria-describedby="id_email_helptext" 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 aria-describedby="id_url_helptext" 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 aria-describedby="id_number_helptext" id="id_number">',
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">',
'<label for="id_dropdown">dropdown</label>',
'<select name="dropdown" aria-describedby="id_dropdown_helptext" 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>",
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">',
"<label>radio</label>",
'<div id="id_radio">',
'<div><label for="id_radio_0"><input type="radio" name="radio" value="Option 1" required id="id_radio_0"> Option 1</label></div>',
'<div><label for="id_radio_1"><input type="radio" name="radio" value="Option 2" required id="id_radio_1"> Option 2</label></div>',
'<div><label for="id_radio_2"><input type="radio" name="radio" value="Option 3" required id="id_radio_2"> Option 3</label></div>',
"</div>",
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">',
"<label>checkboxes</label>",
'<div id="id_checkboxes">',
'<div><label for="id_checkboxes_0"><input type="checkbox" name="checkboxes" value="Option 1" id="id_checkboxes_0"> Option 1</label></div>',
'<div><label for="id_checkboxes_1"><input type="checkbox" name="checkboxes" value="Option 2" id="id_checkboxes_1"> Option 2</label></div>',
'<div><label for="id_checkboxes_2"><input type="checkbox" name="checkboxes" value="Option 3" id="id_checkboxes_2"> Option 3</label></div>',
"</div>",
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">',
'<label for="id_checkbox">checkbox</label>',
'<input type="checkbox" name="checkbox" required aria-describedby="id_checkbox_helptext" 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 aria-describedby="id_singlefile_helptext" 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 aria-describedby="id_multifile_helptext" id="id_multifile">',
'<p class="help-text">Help</p>',
"</div>",
'<div class="field-row">'
'<label for="id_multiline">multiline</label>'
'<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 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 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 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 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 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 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>'
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
"<label>radio</label>"
'<div id="id_radio">'
'<div><label for="id_radio_0">'
'<input type="radio" name="radio" value="Option 1" required id="id_radio_0" /> Option 1'
"</label></div>"
'<div><label for="id_radio_1">'
'<input type="radio" name="radio" value="Option 2" required id="id_radio_1" /> Option 2'
"</label></div>"
'<div><label for="id_radio_2">'
'<input type="radio" name="radio" value="Option 3" required id="id_radio_2" /> Option 3'
"</label></div></div>"
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
"<label>checkboxes</label>"
'<div id="id_checkboxes">'
'<div><label for="id_checkboxes_0">'
'<input type="checkbox" name="checkboxes" value="Option 1" id="id_checkboxes_0" /> Option 1'
"</label></div>"
'<div><label for="id_checkboxes_1">'
'<input type="checkbox" name="checkboxes" value="Option 2" id="id_checkboxes_1" /> Option 2'
"</label></div>"
'<div><label for="id_checkboxes_2">'
'<input type="checkbox" name="checkboxes" value="Option 3" id="id_checkboxes_2" /> Option 3'
"</label></div></div>"
'<p class="help-text">Help</p>'
"</div>"
'<div class="field-row">'
'<label for="id_checkbox">checkbox</label>'
'<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 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 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">'
'<input type="submit" value="Submit">',
"</form>",
]
)
Expand Down
Loading