Skip to content

Commit

Permalink
Django 3.0 support (#1174)
Browse files Browse the repository at this point in the history
* lift the setup.py restrictions

* update files

* fix isort

* add further fixes

* update app helper

* fix docs

* fix last issues

* update docs :)
  • Loading branch information
FinalAngel authored Feb 19, 2020
1 parent 740fe41 commit 4470875
Show file tree
Hide file tree
Showing 27 changed files with 72 additions and 64 deletions.
29 changes: 12 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
language: python

dist: xenial
sudo: false

matrix:
include:
- python: 3.5
- python: 3.6
env: TOX_ENV='flake8'
- python: 3.5
- python: 3.6
env: TOX_ENV='isort'
- python: 3.5
- python: 3.6
env: TOX_ENV='docs'
- python: 3.5
- python: 3.6
env: TOX_ENV='frontend'
# Django 1.11
- python: 2.7
env: DJANGO='dj111' SWAP='noswap'
- python: 3.4
env: DJANGO='dj111' SWAP='noswap'
- python: 3.5
Expand All @@ -23,28 +22,24 @@ matrix:
env: DJANGO='dj111' SWAP='noswap'
- python: 3.6
env: DJANGO='dj111' SWAP='swap'
# Django 2.1
- python: 3.5
env: DJANGO='dj21' SWAP='noswap'
dist: xenial
- python: 3.6
env: DJANGO='dj21' SWAP='swap'
dist: xenial
# Django 2.2
- python: 3.7
env: DJANGO='dj22' SWAP='noswap'
dist: xenial
- python: 3.7
- python: 3.8
env: DJANGO='dj22' SWAP='swap'
dist: xenial
# Django 3.0
- python: 3.7
env: DJANGO='dj30' SWAP='noswap'
- python: 3.8
env: DJANGO='dj30' SWAP='swap'

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=py38; fi"
- "if [[ ${DJANGO}z != 'z' ]]; then export TOX_ENV=$PY_VER-$DJANGO-$SWAP; fi"

before_script:
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,12 @@
CHANGELOG
=========

unreleased
==========

1.7.0 (unreleased)
==================

* Added Django 3.0 support
* Added support for Python 3.8
* Add attribute ``download`` to the download link in order to offer the file
under its original name.

Expand Down
5 changes: 3 additions & 2 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ check `Pillow doc`_.

* for `Django`_ >=1.8,<1.11 use `django-polymorphic`_ 1.3.1
* for `Django`_ >=1.11 use `django-polymorphic`_ >=2.0
* for `Django`_ >=3.0 use `django-polymorphic`_ >=2.1

Configuration
-------------
Expand All @@ -49,8 +50,8 @@ Note that `easy_thumbnails`_ also has database tables and needs a ``python manag
For `easy_thumbnails`_ to support retina displays (recent MacBooks, iOS) add to settings.py::

THUMBNAIL_HIGH_RESOLUTION = True
If you forget this, you may not see thumbnails for your uploaded files. Adding this line and

If you forget this, you may not see thumbnails for your uploaded files. Adding this line and
refreshing the admin page will create the missing thumbnails.


Expand Down
2 changes: 1 addition & 1 deletion docs/running_tests.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ done for you. Tox will setup multiple virtual environments with different python
tox -e py27-dj18 -- test filer.tests.models.FilerApiTests.test_create_folder_structure

Other test runner options are also supported, see
`djangocms-helper <https://djangocms-helper.readthedocs.io/en/latest/>`_
`django-app-helper <https://django-app-helper.readthedocs.io/en/develop/>`_
documentation for details.

To speed things up a bit use `detox <http://pypi.python.org/pypi/detox/>`_. ``detox`` runs each testsuite in a
Expand Down
2 changes: 1 addition & 1 deletion filer/fields/multistorage_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from django.core.files.base import ContentFile
from django.db.models.fields.files import FileDescriptor
from django.utils import six

import six
from easy_thumbnails import fields as easy_thumbnails_fields
from easy_thumbnails import files as easy_thumbnails_files

Expand Down
3 changes: 2 additions & 1 deletion filer/management/commands/filer_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
from django.core.files.storage import DefaultStorage
from django.core.management.base import BaseCommand
from django.utils.module_loading import import_string
from django.utils.six.moves import input

from six.moves import input

from filer import settings as filer_settings

Expand Down
3 changes: 2 additions & 1 deletion filer/models/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
import os

from django.db import models
from django.utils import six
from django.utils.translation import ugettext_lazy as _

import six

from .. import settings as filer_settings
from ..utils.compatibility import PILImage
from ..utils.filer_easy_thumbnails import FilerThumbnailer
Expand Down
3 changes: 2 additions & 1 deletion filer/models/clipboardmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

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

from six import python_2_unicode_compatible

from . import filemodels


Expand Down
3 changes: 2 additions & 1 deletion filer/models/filemodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
from django.db import models
from django.urls import NoReverseMatch, reverse
from django.utils import timezone
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from six import python_2_unicode_compatible

from .. import settings as filer_settings
from ..fields.multistorage_file import MultiStorageFileField
from . import mixins
Expand Down
2 changes: 1 addition & 1 deletion filer/models/foldermodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
from django.db import models
from django.db.models import Q
from django.urls import reverse
from django.utils.encoding import python_2_unicode_compatible
from django.utils.http import urlquote
from django.utils.translation import ugettext_lazy as _

import mptt
from six import python_2_unicode_compatible

from .. import settings as filer_settings
from . import mixins
Expand Down
3 changes: 2 additions & 1 deletion filer/models/thumbnailoptionmodels.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
from __future__ import absolute_import, unicode_literals

from django.db import models
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import ugettext_lazy as _

from six import python_2_unicode_compatible


@python_2_unicode_compatible
class ThumbnailOption(models.Model):
Expand Down
3 changes: 2 additions & 1 deletion filer/templatetags/filer_image_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import re

from django.template import Library
from django.utils import six

import six


register = Library()
Expand Down
3 changes: 2 additions & 1 deletion filer/templatetags/filer_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import math

from django.template import Library
from django.utils import six

import six


register = Library()
Expand Down
3 changes: 1 addition & 2 deletions filer/thumbnail_processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import re

from django.utils import six

import six
from easy_thumbnails import processors

from .settings import (
Expand Down
3 changes: 2 additions & 1 deletion filer/utils/compatibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

import sys

from django.utils import six
from django.utils.functional import keep_lazy
from django.utils.text import Truncator, format_lazy

import six


def string_concat(*strings):
return format_lazy('{}' * len(strings), *strings)
Expand Down
2 changes: 1 addition & 1 deletion filer/utils/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

from importlib import import_module

from django.utils import six
import six


def load_object(import_path):
Expand Down
3 changes: 1 addition & 2 deletions filer/utils/model_label.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
# -*- coding: utf-8 -*-

from __future__ import absolute_import

from django.utils import six
import six


def get_model_label(model):
Expand Down
3 changes: 1 addition & 2 deletions filer/utils/recursive_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

from __future__ import absolute_import

from django.utils import six
import six


__author__ = '[email protected] (Jannis Andrija Schnitzer)'
Expand Down
10 changes: 5 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@


REQUIREMENTS = [
'django>=1.11,<3.0',
'django>=1.11,<4.0',
'django-mptt>=0.6,<1.0', # the exact version depends on Django
'django_polymorphic>=0.7,<2.1',
'django_polymorphic>=0.7,<2.2',
'easy-thumbnails>=2,<3.0',
'Unidecode>=0.04,<1.2',
'six',
]


Expand All @@ -21,17 +22,16 @@
'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 CMS',
'Framework :: Django CMS :: 3.4',
'Framework :: Django CMS :: 3.5',
Expand Down
4 changes: 3 additions & 1 deletion tests/requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Pillow>3.0,!=5.1.0 # pillow 5.1.0 is broken on OS X 10.11 we use on travis

# other requirements
djangocms-helper
django-app-helper
tox
coverage
isort
flake8
5 changes: 0 additions & 5 deletions tests/requirements/django-2.1.txt

This file was deleted.

5 changes: 5 additions & 0 deletions tests/requirements/django-3.0.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-r base.txt

django>=3.0,<3.1
django-mptt>=0.9.1
django_polymorphic>=2.1,<2.2
6 changes: 3 additions & 3 deletions tests/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
'LANGUAGE_CODE': 'en',
'LANGUAGES': (
('en', 'English'),
('fr_FR', 'French'),
('fr', 'French'),
('it', 'Italiano'),
),
'CMS_LANGUAGES': {
Expand All @@ -38,7 +38,7 @@
'public': True,
},
{
'code': 'fr_FR',
'code': 'fr',
'name': 'French',
'public': True,
},
Expand All @@ -63,7 +63,7 @@


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


Expand Down
2 changes: 1 addition & 1 deletion tests/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
from django.core.files import File as DjangoFile
from django.core.management import call_command
from django.test import TestCase
from django.utils.six import StringIO

from six import StringIO
from tests.helpers import (
SettingsOverride, create_folder_structure, create_image, create_superuser,
)
Expand Down
6 changes: 3 additions & 3 deletions tests/test_filer_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
from django.core.management import call_command
from django.test import TestCase
from django.utils.module_loading import import_string
from django.utils.six import StringIO

from six import StringIO
from tests.helpers import create_image

from filer import settings as filer_settings
from filer.models.filemodels import File

from tests.helpers import create_image


class FilerCheckTestCase(TestCase):
def setUp(self):
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
Loading

0 comments on commit 4470875

Please sign in to comment.