-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
django 4.2 support added, python 3.10 support added.
- Loading branch information
1 parent
05ade78
commit 3981d68
Showing
20 changed files
with
65 additions
and
176 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
from django.apps import AppConfig | ||
from django.conf import settings | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class UrlManagerConfig(AppConfig): | ||
name = "djangocms_url_manager" | ||
verbose_name = _("django CMS URL Manager") | ||
url_manager_supported_models = {} | ||
|
||
def ready(self): | ||
from .compat import CMS_36 | ||
|
||
if CMS_36: | ||
from .utils import parse_settings | ||
|
||
self.url_manager_supported_models = parse_settings( | ||
settings, "URL_MANAGER_SUPPORTED_MODELS" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
from django.urls import re_path | ||
from django.urls import path | ||
|
||
from . import constants, views | ||
|
||
|
||
urlpatterns = [ | ||
re_path( | ||
r"^select2/$", | ||
path( | ||
"select2/", | ||
views.ContentTypeObjectSelect2View.as_view(), | ||
name=constants.SELECT2_CONTENT_TYPE_OBJECT_URL_NAME, | ||
), | ||
re_path( | ||
r"^select2/urls/$", views.UrlSelect2View.as_view(), name=constants.SELECT2_URLS | ||
path( | ||
"select2/urls/", views.UrlSelect2View.as_view(), name=constants.SELECT2_URLS | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from djangocms_url_manager.compat import DJANGO_4_2 | ||
|
||
|
||
if not DJANGO_4_2: # TODO: remove when dropping support for Django < 4.2 | ||
from django.test.testcases import TransactionTestCase | ||
|
||
TransactionTestCase.assertQuerySetEqual = TransactionTestCase.assertQuerysetEqual |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
-r requirements_base.txt | ||
|
||
Django>=3.2,<4.0 | ||
|
||
# Unreleased django 3.2 & 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-versioning/tarball/1.2.2#egg=djangocms-versioning | ||
https://github.com/django-cms/djangocms-moderation/tarball/2.1.5#egg=djangocms-moderation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
-r requirements_base.txt | ||
|
||
Django>=4.2,<5.0 | ||
|
||
# Unreleased django 4.2 compatible packages | ||
https://github.com/django-cms/django-cms/tarball/release/4.0.1.x#egg=django-cms | ||
https://github.com/joshyu/djangocms-versioning/tarball/feat/django-42-compatible#egg=djangocms-versioning | ||
https://github.com/FidelityInternational/djangocms-moderation/tarball/feature/django-42-compat#egg=djangocms-moderation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
coverage | ||
django-app-helper | ||
django-classy-tags | ||
django-formtools==2.2 | ||
django-formtools>=2.4.1 | ||
django-sekizai | ||
django-treebeard | ||
djangocms-admin-style | ||
djangocms-attributes-field | ||
factory-boy | ||
flake8 | ||
isort | ||
pyflakes>=2.1.1 | ||
|
||
# Unreleased django-cms 4.0 compatible packages | ||
https://github.com/django-cms/django-cms/tarball/develop-4#egg=django-cms | ||
https://github.com/django-cms/djangocms-versioning/tarball/master#egg=djangocms-versioning | ||
https://github.com/django-cms/djangocms-moderation/tarball/master#egg=djangocms-moderation | ||
pyflakes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,20 @@ | ||
from unittest import skipIf, skipUnless | ||
|
||
from django.apps import apps | ||
from django.test import override_settings | ||
|
||
from cms.models import Page, Placeholder | ||
|
||
from djangocms_url_manager.compat import CMS_36 | ||
from djangocms_url_manager.test_utils.polls.models import PollContent | ||
from djangocms_url_manager.test_utils.polls.utils import ( | ||
get_all_poll_content_objects, | ||
get_published_pages_objects, | ||
) | ||
from djangocms_url_manager.test_utils.polls.utils import get_all_poll_content_objects | ||
from djangocms_url_manager.utils import is_model_supported, supported_models | ||
|
||
from .base import BaseUrlTestCase | ||
|
||
|
||
class UtilsTestCase(BaseUrlTestCase): | ||
@skipUnless(CMS_36, "Test relevant only for CMS<4.0") | ||
def test_supported_models_for_cms36(self): | ||
apps.get_app_config("djangocms_url_manager").ready() | ||
self.assertDictEqual( | ||
supported_models(), | ||
{ | ||
Page: get_published_pages_objects, | ||
PollContent: get_all_poll_content_objects, | ||
}, | ||
) | ||
|
||
@skipIf(CMS_36, "Test relevant only for CMS>=4.0") | ||
def test_supported_models_for_cms40(self): | ||
def test_supported_models(self): | ||
self.assertDictEqual( | ||
supported_models(), {Page: None, PollContent: get_all_poll_content_objects} | ||
) | ||
|
||
@skipUnless(CMS_36, "Test relevant only for CMS<4.0") | ||
@override_settings( | ||
URL_MANAGER_SUPPORTED_MODELS=[ | ||
("cms.Page", get_published_pages_objects), | ||
("polls.PollContent", get_all_poll_content_objects), | ||
] | ||
) | ||
def test_is_model_available_method_for_cms36(self): | ||
apps.get_app_config("djangocms_url_manager").ready() | ||
self.assertTrue(is_model_supported(PollContent)) | ||
self.assertTrue(is_model_supported(Page)) | ||
self.assertFalse(is_model_supported(Placeholder)) | ||
|
||
@skipIf(CMS_36, "Test relevant only for CMS>=4.0") | ||
def test_is_model_available_method_for_cms40(self): | ||
def test_is_model_available_method(self): | ||
self.assertTrue(is_model_supported(PollContent)) | ||
self.assertTrue(is_model_supported(Page)) | ||
self.assertFalse(is_model_supported(Placeholder)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.