Skip to content

Commit 9303fbf

Browse files
authored
Added Django 3.1 support (#70)
* Added Django 3.1 support * fix typo * remove not supported version * rename license file * also adapt manifest file
1 parent 9db4a48 commit 9303fbf

30 files changed

+47
-99
lines changed

.travis.yml

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,38 @@
11
language: python
22

33
dist: xenial
4-
sudo: false
54

65
matrix:
76
include:
87
- python: 3.5
98
env: TOX_ENV='flake8'
109
- python: 3.5
1110
env: TOX_ENV='isort'
12-
# Django 1.11
13-
- python: 2.7
14-
env: DJANGO='dj111' CMS='cms34'
15-
- python: 3.4
16-
env: DJANGO='dj111' CMS='cms35'
17-
- python: 3.5
18-
env: DJANGO='dj111' CMS='cms36'
19-
- python: 3.6
20-
env: DJANGO='dj111' CMS='cms37'
21-
# Django 2.1
22-
- python: 3.6
23-
env: DJANGO='dj21' CMS='cms36'
24-
- python: 3.6
25-
env: DJANGO='dj21' CMS='cms37'
2611
# Django 2.2
12+
- python: 3.5
13+
env: DJANGO='dj22' CMS='cms37'
2714
- python: 3.6
2815
env: DJANGO='dj22' CMS='cms37'
2916
- python: 3.7
3017
env: DJANGO='dj22' CMS='cms37'
31-
18+
- python: 3.8
19+
env: DJANGO='dj22' CMS='cms37'
20+
# Django 3.0, always run the lowest supported version
21+
- python: 3.6
22+
env: DJANGO='dj30' CMS='cms37'
23+
# Django 3.1, always run the lowest supported version
24+
- python: 3.6
25+
env: DJANGO='dj31' CMS='cms38'
26+
allow_failures:
27+
- python: 3.6
28+
env: DJANGO='dj31' CMS='cms38'
3229

3330
install:
3431
- pip install coverage isort tox
35-
- "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export PY_VER=py27; fi"
36-
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PY_VER=py34; fi"
3732
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
3833
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
3934
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
35+
- "if [[ $TRAVIS_PYTHON_VERSION == '3.8' ]]; then export PY_VER=py37; fi"
4036
- "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$CMS; fi"
4137

4238
script:

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@ Changelog
33
=========
44

55

6+
3.0.0 (unreleased)
7+
==================
8+
9+
* Added support for Django 3.1
10+
* Dropped support for Python 2.7 and Python 3.4
11+
* Dropped support for Django < 2.2
12+
13+
614
2.3.0 (2020-01-29)
715
==================
816

LICENSE.txt renamed to LICENSE

File renamed without changes.

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
include LICENSE.txt
1+
include LICENSE
22
include README.rst
33
recursive-include djangocms_snippet/locale *
44
recursive-include djangocms_snippet/templates *

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ You can run tests by executing::
119119
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-snippet/branch/master/graph/badge.svg
120120
:target: https://codecov.io/gh/divio/djangocms-snippet
121121

122-
.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
122+
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
123123
:target: https://pypi.org/project/djangocms-snippet/
124-
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.1%20%7C%202.2-blue.svg
124+
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
125125
:target: https://www.djangoproject.com/
126-
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.4%2B-blue.svg
126+
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.7%2B-blue.svg
127127
:target: https://www.django-cms.org/

aldryn_config.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from aldryn_client import forms
32

43

djangocms_snippet/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
__version__ = '2.3.0'
32

43
default_app_config = 'djangocms_snippet.apps.SnippetConfig'

djangocms_snippet/admin.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from django.conf import settings
32
from django.contrib import admin
43
from django.db import models

djangocms_snippet/apps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# -*- coding: utf-8 -*-
21
from django.apps import AppConfig
3-
from django.utils.translation import ugettext_lazy as _
2+
from django.utils.translation import gettext_lazy as _
43

54

65
class SnippetConfig(AppConfig):

djangocms_snippet/cms_plugins.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
# -*- coding: utf-8 -*-
21
from django import template
32
from django.conf import settings
43
from django.utils.html import escape
54
from django.utils.safestring import mark_safe
6-
from django.utils.translation import ugettext_lazy as _
5+
from django.utils.translation import gettext_lazy as _
76

87
from cms.plugin_base import CMSPluginBase
98
from cms.plugin_pool import plugin_pool

djangocms_snippet/migrations/0001_initial.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
import django.db.models.deletion
52
from django.db import migrations, models
63

djangocms_snippet/migrations/0002_snippet_slug.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

djangocms_snippet/migrations/0003_auto_data_fill_slug.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from collections import Counter
52

63
from django.db import migrations, models

djangocms_snippet/migrations/0004_auto_alter_slug_unique.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

djangocms_snippet/migrations/0005_set_related_name_for_cmsplugin_ptr.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
import django.db.models.deletion
52
from django.db import migrations, models
63

djangocms_snippet/migrations/0006_auto_20160831_0729.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

djangocms_snippet/migrations/0007_auto_alter_template_helptext.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.db import migrations, models
52

63

djangocms_snippet/migrations/0008_auto_change_name.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
# -*- coding: utf-8 -*-
21
# Generated by Django 1.9 on 2018-10-12 10:03
3-
from __future__ import unicode_literals
4-
52
from django.db import migrations
63

74

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

djangocms_snippet/models.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,15 @@
1-
# -*- coding: utf-8 -*-
2-
from __future__ import unicode_literals
3-
41
from django.conf import settings
52
from django.db import models
6-
from django.utils.translation import ugettext_lazy as _
3+
from django.utils.translation import gettext_lazy as _
74

85
from cms.models import CMSPlugin
96

10-
from six import python_2_unicode_compatible
11-
127

138
# Search is enabled by default to keep backwards compatibility.
149
SEARCH_ENABLED = getattr(settings, 'DJANGOCMS_SNIPPET_SEARCH', False)
1510

1611

1712
# Stores the actual data
18-
@python_2_unicode_compatible
1913
class Snippet(models.Model):
2014
"""
2115
A snippet of HTML or a Django template
@@ -57,7 +51,6 @@ class Meta:
5751

5852

5953
# Plugin model - just a pointer to Snippet
60-
@python_2_unicode_compatible
6154
class SnippetPtr(CMSPlugin):
6255
# Add an app namespace to related_name to avoid field name clashes
6356
# with any other plugins that have a field with the same name as the
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

djangocms_snippet/templatetags/snippet_tags.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""
32
Snippet template tags
43
"""
@@ -7,9 +6,7 @@
76
from django import template
87
from django.utils.html import escape
98
from django.utils.safestring import mark_safe
10-
from django.utils.translation import ugettext_lazy as _
11-
12-
from six import string_types
9+
from django.utils.translation import gettext_lazy as _
1310

1411
from djangocms_snippet.models import Snippet
1512

@@ -67,7 +64,7 @@ def render(self, context):
6764
snippet_instance = self.snippet_id_varname.resolve(context)
6865
# Assume this is slug
6966
with exceptionless(self.parse_until):
70-
if isinstance(snippet_instance, string_types):
67+
if isinstance(snippet_instance, str):
7168
snippet_instance = Snippet.objects.get(slug=snippet_instance)
7269
# Assume this is an id
7370
elif isinstance(snippet_instance, int): # pragma: no cover

setup.py

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
from setuptools import find_packages, setup
43

54
from djangocms_snippet import __version__
65

76

87
REQUIREMENTS = [
9-
'django-cms>=3.4.5',
8+
'django-cms>=3.7',
109
]
1110

1211

@@ -17,22 +16,18 @@
1716
'License :: OSI Approved :: BSD License',
1817
'Operating System :: OS Independent',
1918
'Programming Language :: Python',
20-
'Programming Language :: Python :: 2',
21-
'Programming Language :: Python :: 2.7',
2219
'Programming Language :: Python :: 3',
23-
'Programming Language :: Python :: 3.4',
2420
'Programming Language :: Python :: 3.5',
2521
'Programming Language :: Python :: 3.6',
2622
'Programming Language :: Python :: 3.7',
23+
'Programming Language :: Python :: 3.8',
2724
'Framework :: Django',
28-
'Framework :: Django :: 1.11',
29-
'Framework :: Django :: 2.1',
3025
'Framework :: Django :: 2.2',
26+
'Framework :: Django :: 3.0',
27+
'Framework :: Django :: 3.1',
3128
'Framework :: Django CMS',
32-
'Framework :: Django CMS :: 3.4',
33-
'Framework :: Django CMS :: 3.5',
34-
'Framework :: Django CMS :: 3.6',
3529
'Framework :: Django CMS :: 3.7',
30+
'Framework :: Django CMS :: 3.8',
3631
'Topic :: Internet :: WWW/HTTP',
3732
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
3833
'Topic :: Software Development',
@@ -46,10 +41,10 @@
4641
author='Divio AG',
4742
author_email='info@divio.ch',
4843
url='https://github.com/divio/djangocms-snippet',
49-
license='BSD',
44+
license='BSD-3-Clause',
5045
description='Adds snippet plugin to django CMS.',
5146
long_description=open('README.rst').read(),
52-
packages=find_packages(exclude=['tests']),
47+
packages=find_packages(),
5348
include_package_data=True,
5449
zip_safe=False,
5550
install_requires=REQUIREMENTS,

tests/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

tests/settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
32
HELPER_SETTINGS = {
43
'INSTALLED_APPS': [
54
'tests.utils',

tests/test_migrations.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
# -*- coding: utf-8 -*-
21
# original from
32
# http://tech.octopus.energy/news/2016/01/21/testing-for-missing-migrations-in-django.html
3+
from io import StringIO
4+
45
from django.core.management import call_command
56
from django.test import TestCase, override_settings
67

7-
from six import text_type
8-
from six.moves import StringIO
9-
108

119
class MigrationTestCase(TestCase):
1210

@@ -23,7 +21,7 @@ def test_for_missing_migrations(self):
2321
try:
2422
call_command('makemigrations', **options)
2523
except SystemExit as e:
26-
status_code = text_type(e)
24+
status_code = str(e)
2725
else:
2826
# the "no changes" exit code is 0
2927
status_code = '0'

tests/test_models.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from django.test import TestCase
32

43
from djangocms_snippet.models import SEARCH_ENABLED, Snippet, SnippetPtr

tests/test_plugins.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from cms.api import add_plugin, create_page
32
from cms.test_utils.testcases import CMSTestCase
43

tests/test_templatetags.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
from django.core.exceptions import ObjectDoesNotExist
32
from django.template import Context, Template
43
from django.template.exceptions import TemplateSyntaxError

tox.ini

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
envlist =
33
flake8
44
isort
5-
py{27,34,35,36}-dj111-cms{34,35,36}
6-
py{27,35,36}-dj111-cms37
7-
py{35,36,37}-dj{21,22}-cms{36,37}
5+
py{35,36,37,38}-dj{22}-cms{37,38}
6+
py{36,37,38}-dj{30}-cms{37,38}
7+
py{36,37,38}-dj{31}-cms{38}
88

99
skip_missing_interpreters=True
1010

@@ -40,14 +40,11 @@ known_django = django
4040
[testenv]
4141
deps =
4242
-r{toxinidir}/tests/requirements.txt
43-
dj111: Django>=1.11,<2.0
44-
dj111: django-formtools>=2.0,<2.1
45-
dj21: Django>=2.1,<2.2
4643
dj22: Django>=2.2,<3.0
47-
cms34: django-cms>=3.4,<3.5
48-
cms35: django-cms>=3.5,<3.6
49-
cms36: django-cms>=3.6,<3.7
44+
dj30: Django>=3.0,<3.1
45+
dj31: Django>=3.1,<3.2
5046
cms37: django-cms>=3.7,<3.8
47+
cms38: django-cms>=3.8,<3.9
5148
commands =
5249
{envpython} --version
5350
{env:COMMAND:coverage} erase

0 commit comments

Comments
 (0)