From d77b89df4772c5ba9bdf77c20914d68b26a51c95 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 15:47:59 +0800 Subject: [PATCH 01/30] Run django-upgrade --- sandbox/sandbox/settings.py | 2 -- sandbox/sandbox/urls.py | 10 +++++----- src/wagtail_2fa/wagtail_hooks.py | 18 +++++++++--------- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/sandbox/sandbox/settings.py b/sandbox/sandbox/settings.py index 158a57b..567f964 100644 --- a/sandbox/sandbox/settings.py +++ b/sandbox/sandbox/settings.py @@ -130,8 +130,6 @@ USE_I18N = True -USE_L10N = True - USE_TZ = True diff --git a/sandbox/sandbox/urls.py b/sandbox/sandbox/urls.py index 7439f5a..306044b 100644 --- a/sandbox/sandbox/urls.py +++ b/sandbox/sandbox/urls.py @@ -1,7 +1,7 @@ import debug_toolbar from django.conf import settings from django.contrib import admin -from django.urls import include, re_path +from django.urls import include, path, re_path from wagtail import urls as wagtail_urls from wagtail.admin import urls as wagtailadmin_urls @@ -9,9 +9,9 @@ urlpatterns = [ re_path(r'^admin/', admin.site.urls), - re_path(r'^cms/', include(wagtailadmin_urls)), - re_path(r'^documents/', include(wagtaildocs_urls)), - re_path(r'', include(wagtail_urls)), + path('cms/', include(wagtailadmin_urls)), + path('documents/', include(wagtaildocs_urls)), + path('', include(wagtail_urls)), ] @@ -24,5 +24,5 @@ urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns = [ - re_path(r'^__debug__/', include(debug_toolbar.urls)), + path('__debug__/', include(debug_toolbar.urls)), ] + urlpatterns diff --git a/src/wagtail_2fa/wagtail_hooks.py b/src/wagtail_2fa/wagtail_hooks.py index 5271772..2e1b37e 100644 --- a/src/wagtail_2fa/wagtail_hooks.py +++ b/src/wagtail_2fa/wagtail_hooks.py @@ -1,6 +1,6 @@ from django.conf import settings from django.contrib.auth.models import Permission -from django.urls import path, re_path, reverse +from django.urls import path, reverse from django.utils.translation import gettext_lazy as _ from wagtail import hooks @@ -14,8 +14,8 @@ def urlpatterns(): return [ path("2fa/auth", views.LoginView.as_view(), name="wagtail_2fa_auth"), - re_path( - r"^2fa/devices/(?P\d+)$", + path( + "2fa/devices/", views.DeviceListView.as_view(), name="wagtail_2fa_device_list", ), @@ -24,18 +24,18 @@ def urlpatterns(): views.DeviceCreateView.as_view(), name="wagtail_2fa_device_new", ), - re_path( - r"^2fa/devices/(?P\d+)/update$", + path( + "2fa/devices//update", views.DeviceUpdateView.as_view(), name="wagtail_2fa_device_update", ), - re_path( - r"^2fa/devices/(?P\d+)/remove$", + path( + "2fa/devices//remove", views.DeviceDeleteView.as_view(), name="wagtail_2fa_device_remove", ), - re_path( - r"^2fa/devices/qr-code$", + path( + "2fa/devices/qr-code", views.DeviceQRCodeView.as_view(), name="wagtail_2fa_device_qrcode", ), From e7db2d5956c68407962bbeac779ae640358a3ae2 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 15:57:02 +0800 Subject: [PATCH 02/30] Update testing matrix on tox.ini --- tox.ini | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tox.ini b/tox.ini index 2c5cfb8..032e0eb 100644 --- a/tox.ini +++ b/tox.ini @@ -1,8 +1,8 @@ [tox] envlist = - python{3.8,3.9,3.10}-django{3.2,4.1}-wagtail{4.1,4.2,5.0,5.1} - python3.11-django4.1-wagtail{4.1,4.2,5.0,5.1} - python3.11-django4.2-wagtail{5.0,5.1} + python{3.8,3.9,3.10}-django3.2-wagtail5.2 + python{3.8,3.9,3.10,3.11}-django4.2-wagtail{5.2,6.0} + python{3.11,3.12}-django5.0-wagtail{5.2,6.0} [gh-actions] python = @@ -10,6 +10,7 @@ python = 3.9: python3.9 3.10: python3.10 3.11: python3.11 + 3.12: python3.12 [testenv] commands = coverage run --parallel -m pytest {posargs} -vvv @@ -19,15 +20,14 @@ basepython = python3.9: python3.9 python3.10: python3.10 python3.11: python3.11 + python3.12: python3.12 deps = django3.2: Django>=3.2,<4.0 - django4.1: Django>=4.1,<4.2 django4.2: Django>=4.2,<4.3 - wagtail4.1: wagtail>=4.1,<4.2 - wagtail4.2: wagtail>=4.2,<5.0 - wagtail5.0: wagtail>=5.0,<5.1 - wagtail5.1: wagtail>=5.1,<5.2 + django5.0: Django>=5.0,<5.1 + wagtail5.2: wagtail>=5.2,<6.0 + wagtail6.0: wagtail>=6.0,<6.1 extras = test From e0fb638db15efa2c7ece49607be956b0aa704b65 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 15:57:29 +0800 Subject: [PATCH 03/30] Update classifiers, Bump Wagtail version lowerbound --- setup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 04a9c37..fcdaead 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ install_requires = [ "Django>=3.2", - "Wagtail>=4.1", + "Wagtail>=5.2", "django-otp>=0.8.1", "six>=1.14.0", "qrcode>=6.1", @@ -25,6 +25,7 @@ "isort==5.9.3", "flake8-blind-except==0.2.0", "flake8-debugger==4.0.0", + "wagtail-modeladmin==2.0.0" ] with open("README.rst") as fh: @@ -58,18 +59,18 @@ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 3.2", - "Framework :: Django :: 4.1", "Framework :: Django :: 4.2", + "Framework :: Django :: 5.0", "Framework :: Wagtail", - "Framework :: Wagtail :: 2", - "Framework :: Wagtail :: 3", - "Framework :: Wagtail :: 4", + "Framework :: Wagtail :: 5", + "Framework :: Wagtail :: 6", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "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", ], zip_safe=False, ) From 8f2a503d088fa92dea09172a65cb0c780ee3f055 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 16:01:05 +0800 Subject: [PATCH 04/30] Bump Wagtail version lowerbound on sandbox/requirements.txt --- sandbox/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sandbox/requirements.txt b/sandbox/requirements.txt index aebb00e..7a0cef5 100644 --- a/sandbox/requirements.txt +++ b/sandbox/requirements.txt @@ -1,4 +1,4 @@ Django>=3.2 -wagtail>=4.1 +wagtail>=5.2 django-debug-toolbar==3.2.2 -e .[docs,test] From 67a612bdc2aa3f347e41572b93a4d4f1824019f8 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 16:01:48 +0800 Subject: [PATCH 05/30] Bump Wagtail action versions --- .github/workflows/python-release.yml | 8 ++++---- .github/workflows/python-tox.yml | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/python-release.yml b/.github/workflows/python-release.yml index 40ade5e..e25902d 100644 --- a/.github/workflows/python-release.yml +++ b/.github/workflows/python-release.yml @@ -8,11 +8,11 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Set up Python 3.7 - uses: actions/setup-python@v4 + - uses: actions/checkout@v4 + - name: Set up Python 3.8 + uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.8 - name: Install build requirements run: python -m pip install wheel - name: Build package diff --git a/.github/workflows/python-tox.yml b/.github/workflows/python-tox.yml index 51a9ed6..035cc6f 100644 --- a/.github/workflows/python-tox.yml +++ b/.github/workflows/python-tox.yml @@ -8,11 +8,11 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python }} - name: Install dependencies From 7c2ef0f60373036926cb7c7e88d65e219f538c55 Mon Sep 17 00:00:00 2001 From: Katherine Domingo Date: Wed, 28 Feb 2024 16:22:01 +0800 Subject: [PATCH 06/30] Update otp_form and legacy otp_form --- src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html | 4 ++-- src/wagtail_2fa/templates/wagtail_2fa/otp_form.html | 4 ++-- src/wagtail_2fa/views.py | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html b/src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html index 05b3dd1..4186232 100644 --- a/src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html +++ b/src/wagtail_2fa/templates/wagtail_2fa/legacy/otp_form.html @@ -43,7 +43,7 @@

{% block branding_login %}{% trans "Enter your two-factor authentication cod {% endblock %}