Skip to content

Added support for Django 3 #67

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

Merged
merged 1 commit into from
Jan 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion djangocms_snippet/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 3 additions & 2 deletions djangocms_snippet/templatetags/snippet_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
djangocms-helper
django-app-helper
tox
coverage
isort
flake8
# override "pyflakes<2.1" from djangocms-helper
pyflakes>=2.1.0
2 changes: 1 addition & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def run():
from djangocms_helper import runner
from app_helper import runner
runner.cms('djangocms_snippet')


Expand Down
5 changes: 3 additions & 2 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down