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

Adding django CMS 3 compatibility #50

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
8 changes: 7 additions & 1 deletion djangocms_url_manager/cms_config.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

from cms.app_base import CMSAppConfig, CMSAppExtension
from cms.models import Page

from djangocms_url_manager.utils import get_page_search_results, parse_settings

from .models import Url

try:
from cms.app_base import CMSAppConfig, CMSAppExtension
# django CMS 3.x does not have a compatible configuration system
except ImportError:
CMSAppConfig = object
CMSAppExtension = object


class UrlCMSAppConfig(CMSAppConfig):
djangocms_url_manager_enabled = True
Expand Down
8 changes: 6 additions & 2 deletions djangocms_url_manager/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
from django.core.exceptions import ImproperlyConfigured
from django.db.models.base import ModelBase

from cms.models import PageContent

from djangocms_url_manager.compat import CMS_36
from djangocms_url_manager.models import Url

try:
from cms.models import PageContent
# django CMS 3.x
except ImportError:
from cms.models import Title as PageContent


def parse_settings(config, attr_name):
url_manager_supported_models = OrderedDict()
Expand Down
12 changes: 1 addition & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
INSTALL_REQUIREMENTS = [
"Django>=1.11,<3.0",
"django-cms",
"djangocms-attributes-field>=0.1.1",
]

TEST_REQUIREMENTS = [
"djangocms_helper",
"djangocms-versioning",
"djangocms-attributes-field<2.0.0", # django 1.11 compat
]


Expand All @@ -30,14 +25,9 @@
"Topic :: Software Development",
],
install_requires=INSTALL_REQUIREMENTS,
tests_require=TEST_REQUIREMENTS,
author="Divio AG",
author_email="[email protected]",
url="http://github.com/divio/djangocms-url-manager",
license="BSD",
test_suite="test_settings.run",
dependency_links=[
"http://github.com/divio/django-cms/tarball/release/4.0.x#egg=django-cms-4.0.0",
"http://github.com/divio/djangocms-versioning/tarball/master#egg=djangocms-versioning-0.0.23",
]
)
7 changes: 5 additions & 2 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,8 @@ djangocms_helper
pyflakes>=2.1.1
flake8
isort
django-classy-tags<2.0.0
django-sekizai<2.0.0
django-classy-tags<2.0.0 # django 1.11 and 2.1 compat
django-sekizai<2.0.0 # django 1.11 and 2.1 compat
djangocms-admin-style<2.0.0 # django 1.11 and 2.1 compat
django-treebeard<4.4 # django 1.11 and 2.1 compat
http://github.com/divio/djangocms-versioning/tarball/master#egg=djangocms-versioning
4 changes: 2 additions & 2 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ commands =

[testenv:flake8]
commands = flake8
basepython = python3.5
basepython = python3.6

[testenv:isort]
commands = isort --recursive --check-only --diff {toxinidir}
basepython = python3.5
basepython = python3.6