Skip to content

Commit

Permalink
fix: add support of django 4.0 (django-cms#203)
Browse files Browse the repository at this point in the history
* fix: add support of django 4.0

django-cms 3.11 adds the support of django 4.0 but currently
djangocms-link is not compatible with this version of django as there is
use of force_text in the codebase. So we remove the use of this
deprecated method in favor of `force_str`.

Resolve django-cms#202

* Update tests/requirements/dj40_cms311.txt

Co-authored-by: Mark Walker <[email protected]>

Co-authored-by: Vinit Kumar <[email protected]>
Co-authored-by: Mark Walker <[email protected]>
  • Loading branch information
3 people authored Aug 19, 2022
1 parent 3afb7e4 commit faf439b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
dj30_cms37.txt,
dj30_cms38.txt,
dj31_cms38.txt,
dj40_cms311.txt,
]
os: [
ubuntu-20.04,
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
Unreleased
==========

* Added support for Django 4.0
* Display page title instead of menu title


Expand Down
6 changes: 3 additions & 3 deletions djangocms_link/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from django.contrib.sites.models import Site
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.encoding import force_text
from django.utils.encoding import force_str
from django.utils.translation import gettext
from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -216,7 +216,7 @@ def clean(self):
'internal_link',
)

anchor_field_verbose_name = force_text(
anchor_field_verbose_name = force_str(
self._meta.get_field(anchor_field_name).verbose_name)
anchor_field_value = getattr(self, anchor_field_name)

Expand All @@ -225,7 +225,7 @@ def clean(self):
for key in field_names
}
link_field_verbose_names = {
key: force_text(self._meta.get_field(key).verbose_name)
key: force_str(self._meta.get_field(key).verbose_name)
for key in link_fields.keys()
}
provided_link_fields = {
Expand Down
4 changes: 4 additions & 0 deletions tests/requirements/dj40_cms311.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-r base.txt

Django>=4.0,<4.1
django-cms>=3.11,<4.0

0 comments on commit faf439b

Please sign in to comment.