diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 84e55d7..8b7f33f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,10 +16,10 @@ jobs: strategy: fail-fast: false matrix: - python-version: [ 3.7, 3.8, 3.9 ] + python-version: [ 3.8, 3.9, '3.10' ] requirements-file: [ - dj22_cms40.txt, dj32_cms40.txt, + dj42_cms40.txt, ] steps: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 38412ea..54d9c83 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,6 +4,8 @@ Changelog Unreleased ========== +* Introduced Django 4.2 support. +* Dropped Support for Django<3.1 1.2.0 (2022-10-05) ================== diff --git a/djangocms_version_locking/helpers.py b/djangocms_version_locking/helpers.py index 530f82a..1f405b5 100644 --- a/djangocms_version_locking/helpers.py +++ b/djangocms_version_locking/helpers.py @@ -3,7 +3,7 @@ from django.core.exceptions import ObjectDoesNotExist from django.core.mail import EmailMessage from django.template.loader import render_to_string -from django.utils.encoding import force_text +from django.utils.encoding import force_str from djangocms_versioning import versionables from djangocms_versioning.models import Version @@ -139,7 +139,7 @@ def send_email( Send emails using locking templates """ template = 'djangocms_version_locking/emails/{}'.format(template) - subject = force_text(subject) + subject = force_str(subject) content = render_to_string(template, template_context) message = EmailMessage( diff --git a/djangocms_version_locking/monkeypatch/admin.py b/djangocms_version_locking/monkeypatch/admin.py index bc5512f..9600b6a 100644 --- a/djangocms_version_locking/monkeypatch/admin.py +++ b/djangocms_version_locking/monkeypatch/admin.py @@ -1,11 +1,10 @@ -from django.conf.urls import url from django.contrib import messages from django.contrib.admin.utils import unquote from django.http import Http404, HttpResponseForbidden, HttpResponseNotAllowed from django.shortcuts import redirect from django.template.loader import render_to_string -from django.urls import reverse -from django.utils.encoding import force_text +from django.urls import re_path, reverse +from django.utils.encoding import force_str from django.utils.translation import gettext_lazy as _ from djangocms_versioning import admin, constants @@ -67,7 +66,7 @@ def _unlock_view(self, request, object_id): # Check that the user has unlock permission if not request.user.has_perm('djangocms_version_locking.delete_versionlock'): - return HttpResponseForbidden(force_text(_("You do not have permission to remove the version lock"))) + return HttpResponseForbidden(force_str(_("You do not have permission to remove the version lock"))) # Unlock the version remove_version_lock(version) @@ -122,7 +121,7 @@ def _get_urls(func): def inner(self, *args, **kwargs): url_list = func(self, *args, **kwargs) info = self.model._meta.app_label, self.model._meta.model_name - url_list.insert(0, url( + url_list.insert(0, re_path( r'^(.+)/unlock/$', self.admin_site.admin_view(self._unlock_view), name='{}_{}_unlock'.format(*info), diff --git a/setup.py b/setup.py index ceaf459..6396e95 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ INSTALL_REQUIREMENTS = [ - 'Django>=2.2,<4.0', + 'Django>=3.2,<5.0', 'django-cms', ] diff --git a/tests/requirements/dj22_cms40.txt b/tests/requirements/dj22_cms40.txt deleted file mode 100644 index 4492100..0000000 --- a/tests/requirements/dj22_cms40.txt +++ /dev/null @@ -1,3 +0,0 @@ --r requirements_base.txt - -Django>=2.2,<3.0 diff --git a/tests/requirements/dj32_cms40.txt b/tests/requirements/dj32_cms40.txt index e5214ce..0226837 100644 --- a/tests/requirements/dj32_cms40.txt +++ b/tests/requirements/dj32_cms40.txt @@ -1,3 +1,10 @@ -r requirements_base.txt Django>=3.2,<4.0 + +# Unreleased django-cms 4.0 compatible packages +https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms +https://github.com/divio/djangocms-text-ckeditor/tarball/support/4.0.x#egg=djangocms-text-ckeditor +https://github.com/django-cms/djangocms-versioning/tarball/1.2.2#egg=djangocms-versioning +https://github.com/django-cms/djangocms-alias/tarball/1.11.0#egg=djangocms-alias +https://github.com/django-cms/djangocms-moderation/tarball/2.1.5#egg=djangocms-moderation \ No newline at end of file diff --git a/tests/requirements/dj42_cms40.txt b/tests/requirements/dj42_cms40.txt new file mode 100644 index 0000000..5a41bc6 --- /dev/null +++ b/tests/requirements/dj42_cms40.txt @@ -0,0 +1,9 @@ +-r requirements_base.txt + +Django>=4.2,<5.0 + +https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms +https://github.com/django-cms/djangocms-text-ckeditor/tarball/5.1.5#egg=djangocms-text-ckeditor +https://github.com/joshyu/djangocms-versioning/tarball/feat/django-42-compatible#egg=djangocms-versioning +https://github.com/joshyu/djangocms-alias/tarball/feat/django-42-compatible#egg=djangocms-alias +https://github.com/FidelityInternational/djangocms-moderation/tarball/feature/django-42-compat#egg=djangocms-moderation \ No newline at end of file diff --git a/tests/requirements/requirements_base.txt b/tests/requirements/requirements_base.txt index fe1f989..8ad8e68 100644 --- a/tests/requirements/requirements_base.txt +++ b/tests/requirements/requirements_base.txt @@ -7,10 +7,3 @@ flake8 isort mock pyflakes>=2.1.1 - -# Unreleased django-cms 4.0 compatible packages -https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms -https://github.com/divio/djangocms-text-ckeditor/tarball/support/4.0.x#egg=djangocms-text-ckeditor -https://github.com/django-cms/djangocms-versioning/tarball/master#egg=djangocms-versioning -https://github.com/django-cms/djangocms-alias/tarball/master#egg=djangocms-alias -https://github.com/django-cms/djangocms-moderation/tarball/master#egg=djangocms-moderation diff --git a/tox.ini b/tox.ini index 77efdb6..2feff8f 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ envlist = flake8 isort - py{37,38,39}-dj{22,32}-sqlite-cms40 + py{38,39,310}-dj{32,42}-sqlite-cms40 skip_missing_interpreters=True @@ -11,13 +11,13 @@ deps = flake8: -r{toxinidir}/tests/requirements/requirements_base.txt isort: -r{toxinidir}/tests/requirements/requirements_base.txt - dj22: -r{toxinidir}/tests/requirements/dj22_cms40.txt dj32: -r{toxinidir}/tests/requirements/dj32_cms40.txt + dj42: -r{toxinidir}/tests/requirements/dj42_cms40.txt basepython = - py37: python3.7 py38: python3.8 py39: python3.9 + py310: python3.10 commands = {envpython} --version