From 0c12179932b7aae99472fed15f55b9a854469dae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mikael=20Engstr=C3=B6m?= Date: Fri, 23 Aug 2024 11:12:01 +0200 Subject: [PATCH] WT6 support --- .github/workflows/nightly-tests.yml | 48 ------------------ .github/workflows/python-release.yml | 4 +- .github/workflows/python-test.yml | 49 +++---------------- docs/installation.rst | 4 +- docs/settings.rst | 4 +- example/settings.py | 2 +- pyproject.toml | 2 +- requirements.txt | 3 +- setup.py | 3 +- tests/blocks/test_form_block.py | 10 ++-- tests/settings.py | 2 +- tests/templatetags/test_form.py | 7 +-- tox.ini | 17 +++---- wagtailstreamforms/conf.py | 2 +- .../streamforms/advanced_settings.html | 2 +- .../templates/streamforms/confirm_copy.html | 2 +- .../streamforms/index_submissions.html | 2 +- wagtailstreamforms/views/copy.py | 2 +- wagtailstreamforms/views/submission_delete.py | 2 +- wagtailstreamforms/views/submission_list.py | 2 +- wagtailstreamforms/wagtail_hooks.py | 6 +-- .../wagtailstreamforms_fields.py | 31 +----------- 22 files changed, 48 insertions(+), 158 deletions(-) delete mode 100644 .github/workflows/nightly-tests.yml diff --git a/.github/workflows/nightly-tests.yml b/.github/workflows/nightly-tests.yml deleted file mode 100644 index 852c7feb..00000000 --- a/.github/workflows/nightly-tests.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Test against the Wagtail main branch, nightly, as this is required by Wagtail Nest: -# https://github.com/wagtail-nest - -name: Nightly Wagtail test - -on: - schedule: - - cron: "0 0 * * *" - - workflow_dispatch: - -jobs: - nightly-test: - # Cannot check the existence of secrets, so limiting to repository name to prevent - # all forks to run nightly. See: https://github.com/actions/runner/issues/520 - if: ${{ github.repository == 'labd/wagtailstreamforms' }} - runs-on: ubuntu-latest - - services: - postgres: - image: postgres:10.8 - ports: - - 5432:5432 - options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 - - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v1 - with: - python-version: 3.8 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install "psycopg2>=2.6" - pip install "git+https://github.com/wagtail/wagtail.git@main#egg=wagtail" - pip install -e .[test] - - name: Test - id: test - continue-on-error: true - run: | - ./manage.py test - env: - DATABASE_ENGINE: django.db.backends.postgresql - DATABASE_HOST: localhost - DATABASE_USER: postgres - DATABASE_PASS: postgres - DJANGO_SETTINGS_MODULE: tests.settings diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index e4f19036..deaebd27 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -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 diff --git a/.github/workflows/python-test.yml b/.github/workflows/python-test.yml index c73b5e92..6016a157 100644 --- a/.github/workflows/python-test.yml +++ b/.github/workflows/python-test.yml @@ -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 @@ -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 }} @@ -90,10 +55,10 @@ 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 @@ -101,4 +66,4 @@ jobs: - name: Prepare Coverage report run: tox -e coverage-report - name: Upload to codecov - uses: codecov/codecov-action@v1.0.6 \ No newline at end of file + uses: codecov/codecov-action@v1.0.6 diff --git a/docs/installation.rst b/docs/installation.rst index e36dfa18..dc9fef4c 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -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: @@ -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' ... ] diff --git a/docs/settings.rst b/docs/settings.rst index 1489eaa6..d91b4912 100644 --- a/docs/settings.rst +++ b/docs/settings.rst @@ -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 diff --git a/example/settings.py b/example/settings.py index 56241b04..84a896d7 100644 --- a/example/settings.py +++ b/example/settings.py @@ -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', diff --git a/pyproject.toml b/pyproject.toml index c8c642a5..7d5e067d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.black] line-length=99 -target-version=["py39"] +target-version=["py310"] exclude = ''' /( \.git diff --git a/requirements.txt b/requirements.txt index 321459e3..e5247170 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,10 @@ # The app itself -e . -Django>=4.2 +Django>=5.0 mock psycopg2-binary +wagtail-modeladmin # example site django-recaptcha diff --git a/setup.py b/setup.py index fbc5ab21..5f4d133c 100644 --- a/setup.py +++ b/setup.py @@ -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", @@ -72,4 +73,4 @@ "Framework :: Wagtail :: 4", "Topic :: Internet :: WWW/HTTP :: Site Management", ], -) \ No newline at end of file +) diff --git a/tests/blocks/test_form_block.py b/tests/blocks/test_form_block.py index f0b463a2..73c365be 100644 --- a/tests/blocks/test_form_block.py +++ b/tests/blocks/test_form_block.py @@ -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( @@ -53,7 +55,7 @@ def test_render(self): "" '
' '' - '' + '' '

Help

' "
" '
' @@ -114,7 +116,7 @@ def test_render(self): "
" '
' '' - '' + '' '

Help

' "
" '' @@ -153,7 +155,7 @@ def test_render(self): "" '
' '' - '' + '' '

Help

' "
" '
' @@ -214,7 +216,7 @@ def test_render(self): "
" '
' '' - '' + '' '

Help

' "
" '' diff --git a/tests/settings.py b/tests/settings.py index 6fbb8f25..07701daa 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -25,7 +25,7 @@ "wagtail.contrib.redirects", "wagtail.contrib.forms", "wagtail.sites", - "wagtail.contrib.modeladmin", + "wagtail_modeladmin", "wagtail.contrib.settings", "taggit", "wagtailstreamforms", diff --git a/tests/templatetags/test_form.py b/tests/templatetags/test_form.py index 7c9414b2..fcaa2def 100644 --- a/tests/templatetags/test_form.py +++ b/tests/templatetags/test_form.py @@ -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("/") @@ -52,7 +53,7 @@ def test_render(self): "" '
' '' - '' + '' '

Help

' "
" '
' @@ -113,7 +114,7 @@ def test_render(self): "
" '
' '' - '' + '' '

Help

' "
" '' @@ -213,7 +214,7 @@ def test_render(self): "" '
' '' - '' + '' '

Help

' "
" '' diff --git a/tox.ini b/tox.ini index 5aaf848d..7c4868af 100644 --- a/tox.ini +++ b/tox.ini @@ -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 = @@ -80,4 +75,4 @@ deps = black skip_install = true commands = - black --check setup.py wagtailstreamforms/ tests/ \ No newline at end of file + black --check setup.py wagtailstreamforms/ tests/ diff --git a/wagtailstreamforms/conf.py b/wagtailstreamforms/conf.py index 245bd5b5..cf2e9ad3 100644 --- a/wagtailstreamforms/conf.py +++ b/wagtailstreamforms/conf.py @@ -24,7 +24,7 @@ "singlefile", "multifile", ), - "FORM_TEMPLATES": (("streamforms/form_block.html", "Default Form Template"),), + "FORM_TEMPLATES": [("streamforms/form_block.html", "Default Form Template"),], } diff --git a/wagtailstreamforms/templates/streamforms/advanced_settings.html b/wagtailstreamforms/templates/streamforms/advanced_settings.html index a90254c5..e3f81f28 100644 --- a/wagtailstreamforms/templates/streamforms/advanced_settings.html +++ b/wagtailstreamforms/templates/streamforms/advanced_settings.html @@ -13,7 +13,7 @@