Skip to content

Commit e7a0df0

Browse files
committed
Merge branch 'master' into wrds_forms_work
# Conflicts: # setup.py # tests/hooks/test_process_form.py # tox.ini
2 parents 0bdc091 + 1ba77dd commit e7a0df0

File tree

26 files changed

+249
-94
lines changed

26 files changed

+249
-94
lines changed

.circleci/config.yml

Lines changed: 0 additions & 19 deletions
This file was deleted.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Test against the Wagtail main branch, nightly, as this is required by Wagtail Nest:
2+
# https://github.com/wagtail-nest
3+
4+
name: Nightly Wagtail test
5+
6+
on:
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
workflow_dispatch:
11+
12+
jobs:
13+
nightly-test:
14+
# Cannot check the existence of secrets, so limiting to repository name to prevent
15+
# all forks to run nightly. See: https://github.com/actions/runner/issues/520
16+
if: ${{ github.repository == 'labd/wagtailstreamforms' }}
17+
runs-on: ubuntu-latest
18+
19+
services:
20+
postgres:
21+
image: postgres:10.8
22+
ports:
23+
- 5432:5432
24+
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
25+
26+
steps:
27+
- uses: actions/checkout@v2
28+
- name: Set up Python 3.8
29+
uses: actions/setup-python@v1
30+
with:
31+
python-version: 3.8
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install "psycopg2>=2.6"
36+
pip install "git+https://github.com/wagtail/wagtail.git@main#egg=wagtail"
37+
pip install -e .[test]
38+
- name: Test
39+
id: test
40+
continue-on-error: true
41+
run: |
42+
./manage.py test
43+
env:
44+
DATABASE_ENGINE: django.db.backends.postgresql
45+
DATABASE_HOST: localhost
46+
DATABASE_USER: postgres
47+
DATABASE_PASS: postgres
48+
DJANGO_SETTINGS_MODULE: tests.settings

.github/workflows/python-test.yml

Lines changed: 86 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,40 +23,116 @@ jobs:
2323
max-parallel: 4
2424
matrix:
2525
tox_env:
26-
- py37-dj32-wt215
27-
- py37-dj32-wt216
26+
- py310-dj32-wt215
27+
- py310-dj32-wt216
28+
- py310-dj32-wt30
29+
- py310-dj32-wt40
30+
- py310-dj32-wt41
31+
- py310-dj40-wt216
32+
- py310-dj40-wt30
33+
- py310-dj40-wt40
34+
- py310-dj40-wt41
35+
- py310-dj40-wt42
36+
- py310-dj41-wt40
37+
- py310-dj41-wt41
38+
- py310-dj41-wt42
2839
- py38-dj32-wt215
2940
- py38-dj32-wt216
41+
- py38-dj32-wt30
42+
- py38-dj32-wt40
43+
- py38-dj32-wt41
3044
- py38-dj40-wt216
45+
- py38-dj40-wt30
46+
- py38-dj40-wt40
47+
- py38-dj40-wt40
48+
- py38-dj41-wt41
49+
- py38-dj41-wt42
50+
- py38-dj41-wt41
3151
- py39-dj32-wt215
3252
- py39-dj32-wt216
53+
- py39-dj32-wt30
54+
- py39-dj32-wt40
55+
- py39-dj32-wt41
3356
- py39-dj40-wt216
34-
- py310-dj32-wt215
35-
- py310-dj32-wt216
36-
- py310-dj40-wt216
57+
- py39-dj40-wt30
58+
- py39-dj40-wt40
59+
- py39-dj40-wt41
60+
- py39-dj41-wt40
61+
- py39-dj41-wt41
62+
- py39-dj41-wt42
3763
include:
38-
- python-version: 3.7
39-
tox_env: py37-dj32-wt215
40-
- python-version: 3.7
41-
tox_env: py37-dj32-wt216
4264
- python-version: 3.8
4365
tox_env: py38-dj32-wt215
4466
- python-version: 3.8
4567
tox_env: py38-dj32-wt216
68+
- python-version: 3.8
69+
tox_env: py38-dj32-wt30
70+
- python-version: 3.8
71+
tox_env: py38-dj32-wt40
72+
- python-version: 3.8
73+
tox_env: py38-dj32-wt41
4674
- python-version: 3.8
4775
tox_env: py38-dj40-wt216
76+
- python-version: 3.8
77+
tox_env: py38-dj40-wt30
78+
- python-version: 3.8
79+
tox_env: py38-dj40-wt40
80+
- python-version: 3.8
81+
tox_env: py38-dj40-wt41
82+
- python-version: 3.8
83+
tox_env: py38-dj41-wt40
84+
- python-version: 3.8
85+
tox_env: py38-dj41-wt41
86+
- python-version: 3.8
87+
tox_env: py38-dj41-wt42
4888
- python-version: 3.9
4989
tox_env: py39-dj32-wt215
5090
- python-version: 3.9
5191
tox_env: py39-dj32-wt216
92+
- python-version: 3.9
93+
tox_env: py39-dj32-wt30
94+
- python-version: 3.9
95+
tox_env: py39-dj32-wt40
96+
- python-version: 3.9
97+
tox_env: py39-dj32-wt41
5298
- python-version: 3.9
5399
tox_env: py39-dj40-wt216
100+
- python-version: 3.9
101+
tox_env: py39-dj40-wt30
102+
- python-version: 3.9
103+
tox_env: py39-dj40-wt40
104+
- python-version: 3.9
105+
tox_env: py39-dj40-wt41
106+
- python-version: 3.9
107+
tox_env: py39-dj41-wt40
108+
- python-version: 3.9
109+
tox_env: py39-dj41-wt41
110+
- python-version: 3.9
111+
tox_env: py39-dj41-wt42
54112
- python-version: "3.10"
55113
tox_env: py310-dj32-wt215
56114
- python-version: "3.10"
57115
tox_env: py310-dj32-wt216
116+
- python-version: "3.10"
117+
tox_env: py310-dj32-wt30
118+
- python-version: "3.10"
119+
tox_env: py310-dj32-wt40
120+
- python-version: "3.10"
121+
tox_env: py310-dj32-wt41
58122
- python-version: "3.10"
59123
tox_env: py310-dj40-wt216
124+
- python-version: "3.10"
125+
tox_env: py310-dj40-wt30
126+
- python-version: "3.10"
127+
tox_env: py310-dj40-wt40
128+
- python-version: "3.10"
129+
tox_env: py310-dj40-wt41
130+
- python-version: "3.10"
131+
tox_env: py310-dj41-wt40
132+
- python-version: "3.10"
133+
tox_env: py310-dj41-wt41
134+
- python-version: "3.10"
135+
tox_env: py310-dj41-wt42
60136
steps:
61137
- uses: actions/checkout@v2
62138
- name: Set up Python ${{ matrix.python-version }}
@@ -68,7 +144,7 @@ jobs:
68144
python -m pip install --upgrade pip
69145
pip install tox tox-gh-actions
70146
- name: Test with tox
71-
run: tox -e ${{ matrix.tox_env }} --index-url=https://pypi.python.org/simple/
147+
run: tox -e ${{ matrix.tox_env }} -- index-url=https://pypi.python.org/simple/
72148
- name: Prepare artifacts
73149
run: mkdir -p .coverage-data && mv .coverage.* .coverage-data/
74150
- uses: actions/upload-artifact@master

CHANGELOG.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
*********
22
Changelog
33
*********
4+
3.22
5+
----
6+
* Add Wagtail 4.2 support
7+
* Add Django 4.1 support
8+
* Fix issue with FormChooserBlock
9+
10+
3.21.0
11+
------
12+
* Add Wagtail 4.1 support
13+
* Update Wagtail menu icon
14+
* Add nightly test against Wagtail main branch
15+
* feat: show the form reference field in the list view and export
16+
* Update Dutch translations
17+
18+
3.20.1
19+
------
20+
* Remove CircleCI from package
21+
22+
3.20.0
23+
------
24+
* Wagtail 3.0 and 4.0 support
425

526
3.19.1
627
------

README.rst

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Wagtail StreamForms
22
===================
33

4-
|CircleCI| |Codecov|
4+
|tests| |Codecov| |pypi| |github|
55

66
Allows you to build forms in the CMS admin area and add them to any StreamField in your site.
77
You can add your own fields along with the vast array of default fields which include the likes
@@ -90,7 +90,12 @@ Create yourself a superuser
9090
9191
Go to http://127.0.0.1:8000
9292

93-
.. |CircleCI| image:: https://circleci.com/gh/labd/wagtailstreamforms/tree/master.svg?style=svg
94-
:target: https://circleci.com/gh/labd/wagtailstreamforms/tree/master
93+
.. |tests| image:: https://github.com/labd/wagtailstreamforms/workflows/Python%20Tests/badge.svg
94+
:target: https://github.com/labd/wagtailstreamforms/actions?query=workflow%3A%22Python+Tests%22
9595
.. |Codecov| image:: https://codecov.io/gh/labd/wagtailstreamforms/branch/master/graph/badge.svg
9696
:target: https://codecov.io/gh/labd/wagtailstreamforms
97+
.. |pypi| image:: https://img.shields.io/pypi/v/wagtailstreamforms.svg
98+
:target: https://pypi.org/project/wagtailstreamforms/
99+
.. |github| image:: https://img.shields.io/github/stars/labd/wagtailstreamforms.svg?style=social&logo=github
100+
:target: https://github.com/labd/wagtailstreamforms/stargazers
101+

docs/settings.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ Any settings with their defaults are listed below for quick reference.
2727
WAGTAILSTREAMFORMS_FORM_TEMPLATES = (
2828
('streamforms/form_block.html', 'Default Form Template'),
2929
)
30+
31+
# show the form reference field in the list view and export
32+
WAGTAILSTREAMFORMS_SHOW_FORM_REFERENCE = True

setup.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,7 @@
22
ignore=W503
33
max-line-length=99
44
max-complexity=10
5+
exclude=wagtailstreamforms/migrations/*.py
6+
7+
[black]
8+
line-length = 99

setup.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818

1919

2020
install_requires = [
21-
"wagtail>=3,<=4.2",
21+
"wagtail>=2,<4.3",
2222
"Unidecode>=0.04.14,<2.0",
23+
"wagtail-generic-chooser>=0.5.0,<0.6",
2324
]
2425

2526
documentation_extras = [
@@ -68,8 +69,11 @@
6869
"Framework :: Django :: 2.2",
6970
"Framework :: Django :: 3.2",
7071
"Framework :: Django :: 4",
72+
"Framework :: Django :: 4.1",
7173
"Framework :: Wagtail",
7274
"Framework :: Wagtail :: 2",
75+
"Framework :: Wagtail :: 3",
76+
"Framework :: Wagtail :: 4",
7377
"Topic :: Internet :: WWW/HTTP :: Site Management",
7478
],
7579
)

tests/blocks/test_form_chooser_block.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@ def test_value_for_form(self):
1414
block = FormChooserBlock()
1515

1616
self.assertEqual(block.value_for_form(self.form.pk), self.form.pk)
17-
self.assertEqual(block.value_for_form(self.form), self.form.pk)
17+
self.assertEqual(block.value_for_form(self.form), self.form)
1818

1919
def test_value_from_form(self):
2020
block = FormChooserBlock()
2121

22-
# possibly a bug in wagtail as not choosing a value and submitting
23-
# raises invalid literal for int() with base 10: ''
24-
self.assertIsNone(block.value_from_form(""))
25-
2622
self.assertTrue(
2723
isinstance(block.value_from_form(self.form.pk), self.form.__class__)
2824
)

tests/hooks/test_process_form.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
from django.contrib.auth.models import AnonymousUser
22
from django.test import override_settings
33
from django.test.client import Client
4-
from mock import patch
54
from wagtail.models import Page
65

76
from wagtailstreamforms.models import Form
87
from wagtailstreamforms.wagtail_hooks import process_form
98

109
from ..test_case import AppTestCase
1110

11+
try:
12+
from mock import patch
13+
except ModuleNotFoundError:
14+
from unittest.mock import patch
15+
1216

1317
class TestHook(AppTestCase):
1418
fixtures = ["test.json"]

0 commit comments

Comments
 (0)