Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
d77b89d
Run django-upgrade
katdom13 Feb 28, 2024
e7db2d5
Update testing matrix on tox.ini
katdom13 Feb 28, 2024
e0fb638
Update classifiers, Bump Wagtail version lowerbound
katdom13 Feb 28, 2024
8f2a503
Bump Wagtail version lowerbound on sandbox/requirements.txt
katdom13 Feb 28, 2024
67a612b
Bump Wagtail action versions
katdom13 Feb 28, 2024
7c2ef0f
Update otp_form and legacy otp_form
katdom13 Feb 28, 2024
18e3923
Remove usage of deprecated wagtail.contrib.modeladmin
katdom13 Feb 28, 2024
623b06b
Update CHANGES
katdom13 Feb 28, 2024
7bd75a0
Fix createsuperuser command
katdom13 Mar 4, 2024
12fe29e
Merge pull request #5 from torchbox-forks/support/wagtail-60
katdom13 Mar 6, 2024
8e9ec4f
Wagtail 6.1 upgrade consideration: The function signature for the reg…
katdom13 May 14, 2024
a661b86
Update test suite
katdom13 May 14, 2024
ba80f48
Update CHANGES
katdom13 May 14, 2024
c133098
Fix missing icon
katdom13 May 21, 2024
535cf5f
Merge pull request #6 from torchbox-forks/support/wagtail61
katdom13 May 22, 2024
238c6c2
Add testing for Wagtail 6.2
nickmoreton Aug 19, 2024
d066991
Update readme with fork information
nickmoreton Mar 20, 2025
cde6ffd
Merge pull request #9 from torchbox-forks/update-fork-readme
nickmoreton Mar 20, 2025
c9d4728
Merge pull request #7 from torchbox-forks/support/wagtail-62
nickmoreton Mar 20, 2025
7f500c0
Update to incoude testing for Wagtail 6.3
nickmoreton Nov 27, 2024
881e9ee
Update the sanbox requirements
nickmoreton Nov 27, 2024
471d777
Update the CHANGES file
nickmoreton Nov 27, 2024
6d289b6
Merge pull request #8 from torchbox-forks/support/wagtail-63
nickmoreton Mar 20, 2025
e353c96
Remove conditional that's no longer needed
nickmoreton Mar 20, 2025
d3f577d
Add wagtail 6.4 testing to tox.ini
nickmoreton Mar 20, 2025
7fc312c
update CHANGES
nickmoreton Mar 20, 2025
981eb76
Update sandbox requirements to reflect setup.py
nickmoreton Mar 20, 2025
d1bbee0
Adjust minimum python
nickmoreton Mar 21, 2025
ee67c93
Merge pull request #10 from torchbox-forks/support/wagtail-64-upgrade
nickmoreton Mar 21, 2025
d9232dd
Merge remote-tracking branch 'origin/master'
Sep 2, 2025
9848dab
Updates to modern versions of packages and to support currently suppo…
Sep 2, 2025
efa4d1e
Remove unnecessary template
Sep 2, 2025
7684003
Switch button type to make it appear under the more menu
Sep 2, 2025
0daaae5
Update changelog to try and clean up release tagging.
Sep 2, 2025
a78a085
Merge pull request #12 from torchbox-forks/support/wagtail-71-mainten…
damwaingames Sep 2, 2025
6956899
Adjust testing to cover Wagtail 7.2 and Python 3.14
nickmoreton Nov 26, 2025
997eaa6
Update CHANGES
nickmoreton Nov 26, 2025
82c338d
Update README
nickmoreton Nov 26, 2025
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
13 changes: 6 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,19 @@ updates:
ignore:
- dependency-name: flake8
versions:
- 3.8.4
- 3.9.0
- 7.3.0
- dependency-name: coverage
versions:
- "5.4"
- "7.10.1"
- dependency-name: pytest
versions:
- 6.2.2
- 8.4.1
- dependency-name: isort
versions:
- 5.7.0
- 6.0.1
- dependency-name: django-debug-toolbar
versions:
- "3.2"
- "6.0"
- dependency-name: pytest-django
versions:
- 4.1.0
- 4.11.1
4 changes: 0 additions & 4 deletions .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,14 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11

- name: Install build requirements
run: python -m pip install wheel

- name: Build package
run: python setup.py sdist bdist_wheel

- name: Publish package
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
27 changes: 12 additions & 15 deletions .github/workflows/python-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.8", "3.9", "3.10", "3.11"]
python: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions

- name: Test with tox
run: |
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
- name: Test with tox
run: |
tox
9 changes: 8 additions & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
Unreleased
==========
- Add testing for Python 3.14 and Wagtail 7.2
- Update dependencies to latest versions
- Update Wagtail supported versions to 6.3, 7.0 and 7.1 (Currently supported versions)
- Update Django supported versions to 4.2, 5.1 and 5.2 (Currently supported versions)
- Removed old code for handling no longer supported versions

1.7.1 (2025-07-24)
=================
- Update python release workflow to use Python 3.11
Expand All @@ -6,7 +14,6 @@
1.7.0 (2025-07-24)
=================
- Added support for wagtail 6.2 and above


1.6.9 (2023-12-20)
=================
Expand Down
6 changes: 3 additions & 3 deletions sandbox/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Django>=3.2
wagtail>=4.1
django-debug-toolbar==3.2.2
Django>=4.2
wagtail>=6.3
django-debug-toolbar==4.4.6
-e .[docs,test]
107 changes: 90 additions & 17 deletions sandbox/sandbox/apps/user/models.py
Original file line number Diff line number Diff line change
@@ -1,42 +1,115 @@
from django.apps import apps
from django.contrib import auth
from django.contrib.auth.hashers import make_password
from django.contrib.auth.models import (
AbstractBaseUser, PermissionsMixin, UserManager)
AbstractBaseUser,
BaseUserManager,
PermissionsMixin,
)
from django.core.mail import send_mail
from django.db import models
from django.utils import timezone
from django.utils.translation import gettext_lazy as _


class UserManager(BaseUserManager):
use_in_migrations = True

def _create_user(self, email, password, **extra_fields):
"""
Create and save a user with the given email and password.
"""
email = self.normalize_email(email)
# Lookup the real model class from the global app registry so this
# manager method can be used in migrations. This is fine because
# managers are by definition working on the real model.
GlobalUserModel = apps.get_model(
self.model._meta.app_label, self.model._meta.object_name
)
user = self.model(email=email, **extra_fields)
user.password = make_password(password)
user.save(using=self._db)
return user

def create_user(self, email=None, password=None, **extra_fields):
extra_fields.setdefault("is_staff", False)
extra_fields.setdefault("is_superuser", False)
return self._create_user(email, password, **extra_fields)

def create_superuser(self, email=None, password=None, **extra_fields):
extra_fields.setdefault("is_staff", True)
extra_fields.setdefault("is_superuser", True)

if extra_fields.get("is_staff") is not True:
raise ValueError("Superuser must have is_staff=True.")
if extra_fields.get("is_superuser") is not True:
raise ValueError("Superuser must have is_superuser=True.")

return self._create_user(email, password, **extra_fields)

def with_perm(
self, perm, is_active=True, include_superusers=True, backend=None, obj=None
):
if backend is None:
backends = auth._get_backends(return_tuples=True)
if len(backends) == 1:
backend, _ = backends[0]
else:
raise ValueError(
"You have multiple authentication backends configured and "
"therefore must provide the `backend` argument."
)
elif not isinstance(backend, str):
raise TypeError(
"backend must be a dotted import path string (got %r)." % backend
)
else:
backend = auth.load_backend(backend)
if hasattr(backend, "with_perm"):
return backend.with_perm(
perm,
is_active=is_active,
include_superusers=include_superusers,
obj=obj,
)
return self.none()


class User(AbstractBaseUser, PermissionsMixin):
"""Cusomtized version of the default `AbstractUser` from Django.
"""Cusomtized version of the default `AbstractUser` from Django."""

"""
first_name = models.CharField(_('first name'), max_length=100, blank=True)
last_name = models.CharField(_('last name'), max_length=100, blank=True)
email = models.EmailField(_('email address'), blank=True, unique=True)
first_name = models.CharField(_("first name"), max_length=100, blank=True)
last_name = models.CharField(_("last name"), max_length=100, blank=True)
email = models.EmailField(_("email address"), blank=True, unique=True)
is_staff = models.BooleanField(
_('staff status'), default=False,
help_text=_('Designates whether the user can log into this admin '
'site.'))
_("staff status"),
default=False,
help_text=_("Designates whether the user can log into this admin " "site."),
)
is_active = models.BooleanField(
_('active'), default=True,
help_text=_('Designates whether this user should be treated as '
'active. Unselect this instead of deleting accounts.'))
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
_("active"),
default=True,
help_text=_(
"Designates whether this user should be treated as "
"active. Unselect this instead of deleting accounts."
),
)
date_joined = models.DateTimeField(_("date joined"), default=timezone.now)

objects = UserManager()

USERNAME_FIELD = 'email'
USERNAME_FIELD = "email"
REQUIRED_FIELDS = []

class Meta:
verbose_name = _('user')
verbose_name_plural = _('users')
verbose_name = _("user")
verbose_name_plural = _("users")

def get_full_name(self):
"""
Returns the first_name plus the last_name, with a space in between.
"""
full_name = '%s %s' % (self.first_name, self.last_name)
full_name = "%s %s" % (self.first_name, self.last_name)
return full_name.strip()

def get_short_name(self):
Expand Down
5 changes: 1 addition & 4 deletions sandbox/sandbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@
'wagtail.search',
'wagtail.admin',
'wagtail',
# 'wagtail_modeladmin', # if Wagtail >=5.1; Don't repeat if it's there already
'wagtail.contrib.modeladmin', # if Wagtail <5.1; Don't repeat if it's there already
'wagtail_modeladmin',
'wagtail.contrib.styleguide',

'modelcluster',
Expand Down Expand Up @@ -130,8 +129,6 @@

USE_I18N = True

USE_L10N = True

USE_TZ = True


Expand Down
10 changes: 5 additions & 5 deletions sandbox/sandbox/urls.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
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
from wagtail.documents import urls as wagtaildocs_urls

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)),
]


Expand All @@ -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
47 changes: 24 additions & 23 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@
from setuptools import find_packages, setup

install_requires = [
"Django>=3.2",
"Wagtail>=4.1",
"django-otp>=0.8.1",
"six>=1.14.0",
"qrcode>=6.1",
"Django>=4.2",
"Wagtail>=6.3",
"django-otp>=1.6.1",
"six>=1.17.0",
"qrcode>=8.2",
]

docs_require = [
"sphinx>=1.4.1",
"sphinx_rtd_theme>=0.4.3",
"sphinx>=8.2.3",
"sphinx_rtd_theme>=3.0.2",
]

tests_require = [
"coverage==5.5",
"pytest==7.2.2",
"pytest-cov==2.12.1",
"pytest-django==4.4.0",
"coverage==7.10.1",
"pytest==8.4.1",
"pytest-cov==6.2.1",
"pytest-django==4.11.1",
# Linting
"flake8==3.9.2", # 3.7.9
"isort==5.12.0",
"flake8-blind-except==0.2.0",
"flake8-debugger==4.0.0",
"flake8==7.3.0",
"isort==6.0.1",
"flake8-blind-except==0.2.1",
"flake8-debugger==4.1.2",
"wagtail-modeladmin==2.2.0"
]

with open("README.rst") as fh:
Expand All @@ -46,7 +47,7 @@
"docs": docs_require,
"test": tests_require,
},
python_requires=">=3.8",
python_requires=">=3.10",
use_scm_version=True,
entry_points={},
package_dir={"": "src"},
Expand All @@ -57,19 +58,19 @@
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Framework :: Django",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.1",
"Framework :: Django :: 4.2",
"Framework :: Django :: 5.1",
"Framework :: Django :: 5.2",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
"Framework :: Wagtail :: 3",
"Framework :: Wagtail :: 4",
"Framework :: Wagtail :: 6",
"Framework :: Wagtail :: 7",
"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",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
],
zip_safe=False,
)
5 changes: 4 additions & 1 deletion src/wagtail_2fa/templates/wagtail_2fa/device_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ <h2>

{# Users can only add devices to their own account #}
{% if user_id == request.user.id %}
<a href="{% url 'wagtail_2fa_device_new' %}" class="button bicolor icon icon-plus">{% trans 'New device' %}</a>
<a href="{% url 'wagtail_2fa_device_new' %}" class="button bicolor button--icon">
<span class="icon-wrapper"><svg class="icon icon-plus icon" aria-hidden="true"><use href="#icon-plus"></use></svg></span>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: use the {% icon %} tag (https://docs.wagtail.org/en/stable/advanced_topics/icons.html#icon-template-tag)

Suggested change
<span class="icon-wrapper"><svg class="icon icon-plus icon" aria-hidden="true"><use href="#icon-plus"></use></svg></span>
{% icon name="plus" wrapped=1 %}

with {% load wagtailadmin_tags %}

{% trans 'New device' %}
</a>
{% endif %}
</div>
{% endblock %}
Loading