diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3964480f..b153f1c3 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -6,6 +6,7 @@ Changelog 2.3.0 (unreleased) ================== +* Added support for Django 3.0 * Fixed an issue where render requires a dict instead of a context * Added ``DJANGOCMS_SNIPPET_CACHE`` cache settings for snippets * Added further tests to raise coverage diff --git a/djangocms_snippet/models.py b/djangocms_snippet/models.py index cb1e52b2..5420abc5 100644 --- a/djangocms_snippet/models.py +++ b/djangocms_snippet/models.py @@ -6,7 +6,8 @@ from django.utils.translation import ugettext_lazy as _ from cms.models import CMSPlugin -from cms.utils.compat.dj import python_2_unicode_compatible + +from six import python_2_unicode_compatible # Search is enabled by default to keep backwards compatibility. diff --git a/djangocms_snippet/templatetags/snippet_tags.py b/djangocms_snippet/templatetags/snippet_tags.py index 903bcfe3..a269d16a 100644 --- a/djangocms_snippet/templatetags/snippet_tags.py +++ b/djangocms_snippet/templatetags/snippet_tags.py @@ -5,11 +5,12 @@ from contextlib import contextmanager from django import template -from django.utils import six from django.utils.html import escape from django.utils.safestring import mark_safe from django.utils.translation import ugettext_lazy as _ +from six import string_types + from djangocms_snippet.models import Snippet @@ -66,7 +67,7 @@ def render(self, context): snippet_instance = self.snippet_id_varname.resolve(context) # Assume this is slug with exceptionless(self.parse_until): - if isinstance(snippet_instance, six.string_types): + if isinstance(snippet_instance, string_types): snippet_instance = Snippet.objects.get(slug=snippet_instance) # Assume this is an id elif isinstance(snippet_instance, int): # pragma: no cover diff --git a/tests/requirements.txt b/tests/requirements.txt index 5fcd28f9..77fedde3 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -1,7 +1,5 @@ -djangocms-helper +django-app-helper tox coverage isort flake8 -# override "pyflakes<2.1" from djangocms-helper -pyflakes>=2.1.0 diff --git a/tests/settings.py b/tests/settings.py index f6997859..36198c76 100644 --- a/tests/settings.py +++ b/tests/settings.py @@ -16,7 +16,7 @@ def run(): - from djangocms_helper import runner + from app_helper import runner runner.cms('djangocms_snippet') diff --git a/tests/test_migrations.py b/tests/test_migrations.py index 8f52564f..071e0799 100644 --- a/tests/test_migrations.py +++ b/tests/test_migrations.py @@ -3,8 +3,9 @@ # http://tech.octopus.energy/news/2016/01/21/testing-for-missing-migrations-in-django.html from django.core.management import call_command from django.test import TestCase, override_settings -from django.utils.six import text_type -from django.utils.six.moves import StringIO + +from six import text_type +from six.moves import StringIO class MigrationTestCase(TestCase): diff --git a/tests/test_models.py b/tests/test_models.py index 2ac6af43..0a438606 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from django.test import TestCase -from djangocms_snippet.models import Snippet, SnippetPtr, SEARCH_ENABLED +from djangocms_snippet.models import SEARCH_ENABLED, Snippet, SnippetPtr class SnippetModelTestCase(TestCase): diff --git a/tests/test_templatetags.py b/tests/test_templatetags.py index 5f70de04..19c2a404 100644 --- a/tests/test_templatetags.py +++ b/tests/test_templatetags.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from django.test import TestCase -from django.template import Context, Template from django.core.exceptions import ObjectDoesNotExist +from django.template import Context, Template from django.template.exceptions import TemplateSyntaxError +from django.test import TestCase from djangocms_snippet.models import Snippet, SnippetPtr diff --git a/tox.ini b/tox.ini index cb08ec24..d8f606a3 100644 --- a/tox.ini +++ b/tox.ini @@ -41,12 +41,13 @@ known_django = django deps = -r{toxinidir}/tests/requirements.txt dj111: Django>=1.11,<2.0 + dj111: django-formtools>=2.0,<2.1 dj21: Django>=2.1,<2.2 dj22: Django>=2.2,<3.0 cms34: django-cms>=3.4,<3.5 cms35: django-cms>=3.5,<3.6 cms36: django-cms>=3.6,<3.7 - cms37: https://github.com/divio/django-cms/archive/release/3.7.x.zip + cms37: django-cms>=3.7,<3.8 commands = {envpython} --version {env:COMMAND:coverage} erase