Skip to content

Commit

Permalink
Add Django 3.1 support (#12)
Browse files Browse the repository at this point in the history
* ADd DJango 3.1 support

* remove not supported version

* renamce license file

* also adapt manifest
  • Loading branch information
FinalAngel authored Sep 2, 2020
1 parent 5abe1b4 commit fa02a8f
Show file tree
Hide file tree
Showing 22 changed files with 50 additions and 95 deletions.
34 changes: 14 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,38 @@
language: python

sudo: false
dist: xenial

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'
dist: xenial
sudo: true
- 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: 2.7
- 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
=========


1.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


0.3.0 (2020-04-23)
==================

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_transfer/static *
recursive-include djangocms_transfer/templates *
Expand Down
6 changes: 3 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ You can run tests by executing::
.. |coverage| image:: https://codecov.io/gh/divio/djangocms-transfer/branch/master/graph/badge.svg
:target: https://codecov.io/gh/divio/djangocms-transfer

.. |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-transfer/
.. |django| image:: https://img.shields.io/badge/django-1.11%20%7C%202.2%20%7C%203.0-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_transfer/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
__version__ = '0.3.0'

default_app_config = 'djangocms_transfer.apps.TranferConfig'
5 changes: 1 addition & 4 deletions djangocms_transfer/apps.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _


class TranferConfig(AppConfig):
Expand Down
12 changes: 4 additions & 8 deletions djangocms_transfer/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import json

from django.conf.urls import url
from django.core.exceptions import PermissionDenied
from django.http import HttpResponse, HttpResponseBadRequest
from django.shortcuts import render
from django.urls import reverse
from django.urls import re_path, reverse
from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.plugin_base import CMSPluginBase, PluginMenuItem
from cms.plugin_pool import plugin_pool
Expand All @@ -26,8 +22,8 @@ class PluginImporter(CMSPluginBase):

def get_plugin_urls(self):
urlpatterns = [
url(r'^export-plugins/$', self.export_plugins_view, name='cms_export_plugins'),
url(r'^import-plugins/$', self.import_plugins_view, name='cms_import_plugins'),
re_path(r'^export-plugins/$', self.export_plugins_view, name='cms_export_plugins'),
re_path(r'^import-plugins/$', self.import_plugins_view, name='cms_import_plugins'),
]
return urlpatterns

Expand Down
9 changes: 3 additions & 6 deletions djangocms_transfer/cms_toolbars.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.utils.http import urlencode
from django.utils.translation import ugettext
from django.utils.translation import gettext

from cms.api import get_page_draft
from cms.toolbar_base import CMSToolbar
Expand Down Expand Up @@ -47,12 +44,12 @@ def populate(self):

page_menu.add_break('Page menu importer break')
page_menu.add_link_item(
ugettext('Export'),
gettext('Export'),
url=admin_reverse('cms_export_plugins') + '?' + data,
disabled=not_edit_mode,
)
page_menu.add_modal_item(
ugettext('Import'),
gettext('Import'),
url=admin_reverse('cms_import_plugins') + '?' + data,
disabled=not_edit_mode,
on_close=getattr(self.toolbar, 'request_path', self.request.path),
Expand Down
1 change: 0 additions & 1 deletion djangocms_transfer/compat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# -*- coding: utf-8 -*-
from distutils.version import LooseVersion

import cms
Expand Down
3 changes: 0 additions & 3 deletions djangocms_transfer/datastructures.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 namedtuple

from django.core.serializers import deserialize
Expand Down
3 changes: 0 additions & 3 deletions djangocms_transfer/exporter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import functools
import itertools
import json
Expand Down
5 changes: 1 addition & 4 deletions djangocms_transfer/forms.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import json

from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _

from cms.models import CMSPlugin, Page, Placeholder

Expand Down
3 changes: 0 additions & 3 deletions djangocms_transfer/helpers.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 defaultdict

from django.core import serializers
Expand Down
3 changes: 0 additions & 3 deletions djangocms_transfer/importer.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 transaction

from cms.models import CMSPlugin
Expand Down
6 changes: 1 addition & 5 deletions djangocms_transfer/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# -*- coding: utf-8 -*-
try:
from django.utils.lru_cache import lru_cache
except ImportError:
from functools import lru_cache
from functools import lru_cache

from cms.plugin_pool import plugin_pool

Expand Down
17 changes: 5 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_transfer import __version__


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


Expand All @@ -17,24 +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 @@ -48,10 +41,10 @@
author='Divio AG',
author_email='[email protected]',
url='http://github.com/divio/djangocms-transfer',
license='BSD',
license='BSD-3-Clause',
description='Adds import and export of plugin data.',
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': [],
'CMS_LANGUAGES': {
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
16 changes: 6 additions & 10 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,15 +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
dj111: django-appconf<=1.0.2
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

0 comments on commit fa02a8f

Please sign in to comment.