From f8a80cafdbbd3af93a61591f93e707d55aa13b9d Mon Sep 17 00:00:00 2001 From: Josh Yu Date: Sun, 10 Mar 2024 06:30:57 +0000 Subject: [PATCH 1/4] feat: django4.2 compatible --- .github/workflows/test.yml | 4 ++-- CHANGELOG.rst | 2 ++ djangocms_version_locking/helpers.py | 4 ++-- djangocms_version_locking/monkeypatch/admin.py | 9 ++++----- setup.py | 2 +- tests/requirements/dj22_cms40.txt | 3 --- tests/requirements/dj32_cms40.txt | 7 +++++++ tests/requirements/dj42_cms40.txt | 9 +++++++++ tests/requirements/requirements_base.txt | 7 ------- tox.ini | 6 +++--- 10 files changed, 30 insertions(+), 23 deletions(-) delete mode 100644 tests/requirements/dj22_cms40.txt create mode 100644 tests/requirements/dj42_cms40.txt 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 From 9e0aa58aec542b17837de4b21e1df2aa890c2815 Mon Sep 17 00:00:00 2001 From: Josh Yu Date: Sun, 10 Mar 2024 07:01:53 +0000 Subject: [PATCH 2/4] fix: update dj42_cms40.txt dependency --- tests/requirements/dj32_cms40.txt | 2 +- tests/requirements/dj42_cms40.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/requirements/dj32_cms40.txt b/tests/requirements/dj32_cms40.txt index 0226837..10b6d70 100644 --- a/tests/requirements/dj32_cms40.txt +++ b/tests/requirements/dj32_cms40.txt @@ -4,7 +4,7 @@ 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-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 index 5a41bc6..12ee1ce 100644 --- a/tests/requirements/dj42_cms40.txt +++ b/tests/requirements/dj42_cms40.txt @@ -3,7 +3,7 @@ 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/django-cms/djangocms-text-ckeditor/tarball/support/4.0.x#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 From aae58ad389646c93fa2ad27773780053dd56163d Mon Sep 17 00:00:00 2001 From: Josh Peng Yu Date: Mon, 18 Mar 2024 08:18:27 +0000 Subject: [PATCH 3/4] feat: update tests requirements --- tests/requirements/dj32_cms40.txt | 1 - tests/requirements/dj42_cms40.txt | 9 ++++----- tests/requirements/requirements_base.txt | 2 ++ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/requirements/dj32_cms40.txt b/tests/requirements/dj32_cms40.txt index 10b6d70..7c8f1d3 100644 --- a/tests/requirements/dj32_cms40.txt +++ b/tests/requirements/dj32_cms40.txt @@ -3,7 +3,6 @@ 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/django-cms/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 diff --git a/tests/requirements/dj42_cms40.txt b/tests/requirements/dj42_cms40.txt index 12ee1ce..69bdcc2 100644 --- a/tests/requirements/dj42_cms40.txt +++ b/tests/requirements/dj42_cms40.txt @@ -2,8 +2,7 @@ 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/support/4.0.x#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 +https://github.com/django-cms/djangocms-text-ckeditor/tarball/5.1.5#egg=djangocms-text-ckeditor +https://github.com/django-cms/djangocms-versioning/tarball/support/django-cms-4.0.x#egg=djangocms-versioning +https://github.com/django-cms/djangocms-alias/tarball/support/django-cms-4.0.x#egg=djangocms-alias +https://github.com/django-cms/djangocms-moderation/tarball/master#egg=djangocms-moderation \ No newline at end of file diff --git a/tests/requirements/requirements_base.txt b/tests/requirements/requirements_base.txt index 8ad8e68..ed7b5b3 100644 --- a/tests/requirements/requirements_base.txt +++ b/tests/requirements/requirements_base.txt @@ -7,3 +7,5 @@ flake8 isort mock pyflakes>=2.1.1 + +https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms \ No newline at end of file From 2b15c3f472fbf51bb27e5442a53f8113d8b9002f Mon Sep 17 00:00:00 2001 From: Josh Peng Yu Date: Mon, 18 Mar 2024 08:58:01 +0000 Subject: [PATCH 4/4] fix: migration dependency error --- test_settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/test_settings.py b/test_settings.py index cf289dd..6ec13a7 100644 --- a/test_settings.py +++ b/test_settings.py @@ -17,6 +17,7 @@ 'djangocms_version_locking': None, 'djangocms_alias': None, 'djangocms_moderation': None, + 'djangocms_text_ckeditor': None }, 'CMS_PERMISSION': True, 'LANGUAGES': (