Skip to content

Commit fda3c94

Browse files
authored
Added support for Django 3 (#67)
1 parent 95a03cb commit fda3c94

File tree

9 files changed

+16
-13
lines changed

9 files changed

+16
-13
lines changed

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ Changelog
66
2.3.0 (unreleased)
77
==================
88

9+
* Added support for Django 3.0
910
* Fixed an issue where render requires a dict instead of a context
1011
* Added ``DJANGOCMS_SNIPPET_CACHE`` cache settings for snippets
1112
* Added further tests to raise coverage

djangocms_snippet/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from django.utils.translation import ugettext_lazy as _
77

88
from cms.models import CMSPlugin
9-
from cms.utils.compat.dj import python_2_unicode_compatible
9+
10+
from six import python_2_unicode_compatible
1011

1112

1213
# Search is enabled by default to keep backwards compatibility.

djangocms_snippet/templatetags/snippet_tags.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
from contextlib import contextmanager
66

77
from django import template
8-
from django.utils import six
98
from django.utils.html import escape
109
from django.utils.safestring import mark_safe
1110
from django.utils.translation import ugettext_lazy as _
1211

12+
from six import string_types
13+
1314
from djangocms_snippet.models import Snippet
1415

1516

@@ -66,7 +67,7 @@ def render(self, context):
6667
snippet_instance = self.snippet_id_varname.resolve(context)
6768
# Assume this is slug
6869
with exceptionless(self.parse_until):
69-
if isinstance(snippet_instance, six.string_types):
70+
if isinstance(snippet_instance, string_types):
7071
snippet_instance = Snippet.objects.get(slug=snippet_instance)
7172
# Assume this is an id
7273
elif isinstance(snippet_instance, int): # pragma: no cover

tests/requirements.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
djangocms-helper
1+
django-app-helper
22
tox
33
coverage
44
isort
55
flake8
6-
# override "pyflakes<2.1" from djangocms-helper
7-
pyflakes>=2.1.0

tests/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717

1818
def run():
19-
from djangocms_helper import runner
19+
from app_helper import runner
2020
runner.cms('djangocms_snippet')
2121

2222

tests/test_migrations.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
# http://tech.octopus.energy/news/2016/01/21/testing-for-missing-migrations-in-django.html
44
from django.core.management import call_command
55
from django.test import TestCase, override_settings
6-
from django.utils.six import text_type
7-
from django.utils.six.moves import StringIO
6+
7+
from six import text_type
8+
from six.moves import StringIO
89

910

1011
class MigrationTestCase(TestCase):

tests/test_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# -*- coding: utf-8 -*-
22
from django.test import TestCase
33

4-
from djangocms_snippet.models import Snippet, SnippetPtr, SEARCH_ENABLED
4+
from djangocms_snippet.models import SEARCH_ENABLED, Snippet, SnippetPtr
55

66

77
class SnippetModelTestCase(TestCase):

tests/test_templatetags.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# -*- coding: utf-8 -*-
2-
from django.test import TestCase
3-
from django.template import Context, Template
42
from django.core.exceptions import ObjectDoesNotExist
3+
from django.template import Context, Template
54
from django.template.exceptions import TemplateSyntaxError
5+
from django.test import TestCase
66

77
from djangocms_snippet.models import Snippet, SnippetPtr
88

tox.ini

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ known_django = django
4141
deps =
4242
-r{toxinidir}/tests/requirements.txt
4343
dj111: Django>=1.11,<2.0
44+
dj111: django-formtools>=2.0,<2.1
4445
dj21: Django>=2.1,<2.2
4546
dj22: Django>=2.2,<3.0
4647
cms34: django-cms>=3.4,<3.5
4748
cms35: django-cms>=3.5,<3.6
4849
cms36: django-cms>=3.6,<3.7
49-
cms37: https://github.com/divio/django-cms/archive/release/3.7.x.zip
50+
cms37: django-cms>=3.7,<3.8
5051
commands =
5152
{envpython} --version
5253
{env:COMMAND:coverage} erase

0 commit comments

Comments
 (0)