Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Django4.2 compatible #83

Merged
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog

Unreleased
==========
* Introduced Django 4.2 support.
* Dropped Support for Django<3.1

1.2.0 (2022-10-05)
==================
Expand Down
4 changes: 2 additions & 2 deletions djangocms_version_locking/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down
9 changes: 4 additions & 5 deletions djangocms_version_locking/monkeypatch/admin.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


INSTALL_REQUIREMENTS = [
'Django>=2.2,<4.0',
'Django>=3.2,<5.0',
'django-cms',
]

Expand Down
3 changes: 0 additions & 3 deletions tests/requirements/dj22_cms40.txt

This file was deleted.

7 changes: 7 additions & 0 deletions tests/requirements/dj32_cms40.txt
Original file line number Diff line number Diff line change
@@ -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/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
9 changes: 9 additions & 0 deletions tests/requirements/dj42_cms40.txt
Original file line number Diff line number Diff line change
@@ -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/support/4.0.x#egg=djangocms-text-ckeditor
Copy link
Member

Choose a reason for hiding this comment

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

@joshyu Can you use the latest text ckeditor branch

Copy link
Member Author

Choose a reason for hiding this comment

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

I will update the requirements later. Thanks for pointing this out.

Copy link
Member Author

Choose a reason for hiding this comment

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

@vipulnarang95 , please help to review again. I have updated the test requirement version.

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
7 changes: 0 additions & 7 deletions tests/requirements/requirements_base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
Loading