Skip to content

Added Django 3.1 support #70

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 5 commits into from
Sep 2, 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
32 changes: 14 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
language: python

dist: xenial
sudo: false

matrix:
include:
- python: 3.5
env: TOX_ENV='flake8'
- python: 3.5
env: TOX_ENV='isort'
# Django 1.11
- python: 2.7
env: DJANGO='dj111' CMS='cms34'
- python: 3.4
env: DJANGO='dj111' CMS='cms35'
- python: 3.5
env: DJANGO='dj111' CMS='cms36'
- python: 3.6
env: DJANGO='dj111' CMS='cms37'
# Django 2.1
- python: 3.6
env: DJANGO='dj21' CMS='cms36'
- python: 3.6
env: DJANGO='dj21' CMS='cms37'
# Django 2.2
- python: 3.5
env: DJANGO='dj22' CMS='cms37'
- python: 3.6
env: DJANGO='dj22' CMS='cms37'
- python: 3.7
env: DJANGO='dj22' CMS='cms37'

- python: 3.8
env: DJANGO='dj22' CMS='cms37'
# Django 3.0, always run the lowest supported version
- python: 3.6
env: DJANGO='dj30' CMS='cms37'
# Django 3.1, always run the lowest supported version
- python: 3.6
env: DJANGO='dj31' CMS='cms38'
allow_failures:
- python: 3.6
env: DJANGO='dj31' CMS='cms38'

install:
- pip install coverage isort tox
- "if [[ $TRAVIS_PYTHON_VERSION == '2.7' ]]; then export PY_VER=py27; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.4' ]]; then export PY_VER=py34; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.5' ]]; then export PY_VER=py35; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then export PY_VER=py36; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.7' ]]; then export PY_VER=py37; fi"
- "if [[ $TRAVIS_PYTHON_VERSION == '3.8' ]]; then export PY_VER=py37; fi"
- "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$CMS; fi"

script:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@ Changelog
=========


3.0.0 (unreleased)
==================

* Added support for Django 3.1
* Dropped support for Python 2.7 and Python 3.4
* Dropped support for Django < 2.2


2.3.0 (2020-01-29)
==================

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include LICENSE.txt
include LICENSE
include README.rst
recursive-include djangocms_snippet/locale *
recursive-include djangocms_snippet/templates *
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ You can run tests by executing::
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-snippet/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/djangocms-snippet

.. |python| image:: https://img.shields.io/badge/python-2.7%20%7C%203.4+-blue.svg
.. |python| image:: https://img.shields.io/badge/python-3.5+-blue.svg
:target: https://pypi.org/project/djangocms-snippet/
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.1%20%7C%202.2-blue.svg
.. |django| image:: https://img.shields.io/badge/django-2.2,%203.0,%203.1-blue.svg
:target: https://www.djangoproject.com/
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.4%2B-blue.svg
.. |djangocms| image:: https://img.shields.io/badge/django%20CMS-3.7%2B-blue.svg
:target: https://www.django-cms.org/
1 change: 0 additions & 1 deletion aldryn_config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from aldryn_client import forms


Expand Down
1 change: 0 additions & 1 deletion djangocms_snippet/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
__version__ = '2.3.0'

default_app_config = 'djangocms_snippet.apps.SnippetConfig'
1 change: 0 additions & 1 deletion djangocms_snippet/admin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.conf import settings
from django.contrib import admin
from django.db import models
Expand Down
3 changes: 1 addition & 2 deletions djangocms_snippet/apps.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# -*- coding: utf-8 -*-
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class SnippetConfig(AppConfig):
Expand Down
3 changes: 1 addition & 2 deletions djangocms_snippet/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# -*- coding: utf-8 -*-
from django import template
from django.conf import settings
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models

Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0002_snippet_slug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0003_auto_data_fill_slug.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from collections import Counter

from django.db import migrations, models
Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0004_auto_alter_slug_unique.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import django.db.models.deletion
from django.db import migrations, models

Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0006_auto_20160831_0729.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


Expand Down
3 changes: 0 additions & 3 deletions djangocms_snippet/migrations/0008_auto_change_name.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9 on 2018-10-12 10:03
from __future__ import unicode_literals

from django.db import migrations


Expand Down
1 change: 0 additions & 1 deletion djangocms_snippet/migrations/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
9 changes: 1 addition & 8 deletions djangocms_snippet/models.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,15 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.conf import settings
from django.db import models
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.models import CMSPlugin

from six import python_2_unicode_compatible


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


# Stores the actual data
@python_2_unicode_compatible
class Snippet(models.Model):
"""
A snippet of HTML or a Django template
Expand Down Expand Up @@ -57,7 +51,6 @@ class Meta:


# Plugin model - just a pointer to Snippet
@python_2_unicode_compatible
class SnippetPtr(CMSPlugin):
# Add an app namespace to related_name to avoid field name clashes
# with any other plugins that have a field with the same name as the
Expand Down
1 change: 0 additions & 1 deletion djangocms_snippet/templatetags/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
7 changes: 2 additions & 5 deletions djangocms_snippet/templatetags/snippet_tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
"""
Snippet template tags
"""
Expand All @@ -7,9 +6,7 @@
from django import template
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 django.utils.translation import gettext_lazy as _

from djangocms_snippet.models import Snippet

Expand Down Expand Up @@ -67,7 +64,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, string_types):
if isinstance(snippet_instance, str):
snippet_instance = Snippet.objects.get(slug=snippet_instance)
# Assume this is an id
elif isinstance(snippet_instance, int): # pragma: no cover
Expand Down
19 changes: 7 additions & 12 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import find_packages, setup

from djangocms_snippet import __version__


REQUIREMENTS = [
'django-cms>=3.4.5',
'django-cms>=3.7',
]


Expand All @@ -17,22 +16,18 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Framework :: Django',
'Framework :: Django :: 1.11',
'Framework :: Django :: 2.1',
'Framework :: Django :: 2.2',
'Framework :: Django :: 3.0',
'Framework :: Django :: 3.1',
'Framework :: Django CMS',
'Framework :: Django CMS :: 3.4',
'Framework :: Django CMS :: 3.5',
'Framework :: Django CMS :: 3.6',
'Framework :: Django CMS :: 3.7',
'Framework :: Django CMS :: 3.8',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Internet :: WWW/HTTP :: Dynamic Content',
'Topic :: Software Development',
Expand All @@ -46,10 +41,10 @@
author='Divio AG',
author_email='info@divio.ch',
url='https://github.com/divio/djangocms-snippet',
license='BSD',
license='BSD-3-Clause',
description='Adds snippet plugin to django CMS.',
long_description=open('README.rst').read(),
packages=find_packages(exclude=['tests']),
packages=find_packages(),
include_package_data=True,
zip_safe=False,
install_requires=REQUIREMENTS,
Expand Down
1 change: 0 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
# -*- coding: utf-8 -*-
1 change: 0 additions & 1 deletion tests/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
HELPER_SETTINGS = {
'INSTALLED_APPS': [
'tests.utils',
Expand Down
8 changes: 3 additions & 5 deletions tests/test_migrations.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
# -*- coding: utf-8 -*-
# original from
# http://tech.octopus.energy/news/2016/01/21/testing-for-missing-migrations-in-django.html
from io import StringIO

from django.core.management import call_command
from django.test import TestCase, override_settings

from six import text_type
from six.moves import StringIO


class MigrationTestCase(TestCase):

Expand All @@ -23,7 +21,7 @@ def test_for_missing_migrations(self):
try:
call_command('makemigrations', **options)
except SystemExit as e:
status_code = text_type(e)
status_code = str(e)
else:
# the "no changes" exit code is 0
status_code = '0'
Expand Down
1 change: 0 additions & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.test import TestCase

from djangocms_snippet.models import SEARCH_ENABLED, Snippet, SnippetPtr
Expand Down
1 change: 0 additions & 1 deletion tests/test_plugins.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from cms.api import add_plugin, create_page
from cms.test_utils.testcases import CMSTestCase

Expand Down
1 change: 0 additions & 1 deletion tests/test_templatetags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from django.core.exceptions import ObjectDoesNotExist
from django.template import Context, Template
from django.template.exceptions import TemplateSyntaxError
Expand Down
15 changes: 6 additions & 9 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
envlist =
flake8
isort
py{27,34,35,36}-dj111-cms{34,35,36}
py{27,35,36}-dj111-cms37
py{35,36,37}-dj{21,22}-cms{36,37}
py{35,36,37,38}-dj{22}-cms{37,38}
py{36,37,38}-dj{30}-cms{37,38}
py{36,37,38}-dj{31}-cms{38}

skip_missing_interpreters=True

Expand Down Expand Up @@ -40,14 +40,11 @@ known_django = django
[testenv]
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
dj30: Django>=3.0,<3.1
dj31: Django>=3.1,<3.2
cms37: django-cms>=3.7,<3.8
cms38: django-cms>=3.8,<3.9
commands =
{envpython} --version
{env:COMMAND:coverage} erase
Expand Down