Skip to content

Commit

Permalink
Added Django 2.2, 3.0, 3.1 to testing matrix (with fixes). Bumped Pyt…
Browse files Browse the repository at this point in the history
…hon version to 3.7.
  • Loading branch information
David Krauth authored and dakrauth committed Mar 15, 2021
1 parent c8ee311 commit 15c30d2
Show file tree
Hide file tree
Showing 21 changed files with 47 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ test/media
dist/
.coverage
/reports/
.python-version
2 changes: 1 addition & 1 deletion cropduster/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '4.13.2'
__version__ = '4.14.0'
6 changes: 3 additions & 3 deletions cropduster/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
import copy
import errno

import six
from six.moves import xrange

try:
from django.urls import get_urlconf, get_resolver
except ImportError:
from django.core.urlresolvers import get_urlconf, get_resolver
from django.http import HttpResponse
from django.utils.safestring import mark_safe
from django.utils import six
from django.utils.six.moves import xrange

from django.utils.encoding import force_text


Expand Down
2 changes: 1 addition & 1 deletion cropduster/fields.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import contextlib
from operator import attrgetter

import six
import django
from django import forms
from django.db import models, transaction, router, DEFAULT_DB_ALIAS
from django.db.models.fields import Field
from django.db.models.fields.files import ImageFileDescriptor, ImageFieldFile
from django.db.models.fields.related import ManyToManyRel, ManyToManyField
from django.utils.functional import cached_property
from django.utils import six
from django.contrib.contenttypes.models import ContentType

from generic_plus.fields import GenericForeignFileField
Expand Down
5 changes: 3 additions & 2 deletions cropduster/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
import re
import hashlib

from six.moves.urllib import parse as urlparse
from six.moves.urllib.request import urlopen

from django.core.files.images import get_image_dimensions
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.files.storage import default_storage
from django.conf import settings
from django.db.models.fields.files import FieldFile, FileField
from django.utils.functional import cached_property
from django.utils.http import urlunquote_plus
from django.utils.six.moves.urllib import parse as urlparse
from django.utils.six.moves.urllib.request import urlopen

from generic_plus.utils import get_relative_media_url, get_media_path

Expand Down
2 changes: 1 addition & 1 deletion cropduster/forms.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import six
from django import forms
from django.core.exceptions import ValidationError
from django.forms.models import ModelChoiceIterator
from django.forms.models import ChoiceField, ModelMultipleChoiceField
from django.forms.utils import flatatt
from django.utils.encoding import force_text
from django.utils.html import escape, conditional_escape
from django.utils import six

from generic_plus.forms import BaseGenericFileInlineFormSet, GenericForeignFileWidget

Expand Down
10 changes: 5 additions & 5 deletions cropduster/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import time
from datetime import datetime

import six
from six.moves import xrange

from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.core.files.storage import FileSystemStorage
from django.contrib.contenttypes.fields import GenericForeignKey
from django.contrib.contenttypes.models import ContentType
from django.db import connection, models
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six.moves import xrange
from django.core.files.storage import default_storage, FileSystemStorage

import PIL.Image
Expand Down Expand Up @@ -44,7 +44,7 @@ def safe_str_path(file_path):
return file_path


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class Thumb(models.Model):

name = models.CharField(max_length=255, db_index=True)
Expand Down Expand Up @@ -213,7 +213,7 @@ def generate_filename(instance, filename):
return filename


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class Image(models.Model):

content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
Expand Down
9 changes: 4 additions & 5 deletions cropduster/resizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
import hashlib
import tempfile

import six
from six.moves import filter
import PIL.Image

from django.core.exceptions import ImproperlyConfigured
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
from django.utils.six.moves import filter
from django.core.files.storage import default_storage

from .settings import CROPDUSTER_RETAIN_METADATA
Expand All @@ -23,7 +22,7 @@
INFINITY = float('inf')


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class SizeAlias(object):
is_alias = True

Expand All @@ -46,7 +45,7 @@ def add_to_sizes_dict(self, sizes):
ctx.update(size_to)


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class Size(object):

is_alias = False
Expand Down
2 changes: 1 addition & 1 deletion cropduster/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import PIL
import distutils.spawn
from distutils.version import LooseVersion
import six
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils import six


CROPDUSTER_MEDIA_ROOT = getattr(settings, 'CROPDUSTER_MEDIA_ROOT', settings.MEDIA_ROOT)
Expand Down
2 changes: 1 addition & 1 deletion cropduster/standalone/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import tempfile
from io import open

import six
from django.core.exceptions import ImproperlyConfigured
from django.core.files.storage import default_storage
from django.utils.encoding import force_bytes
from django.utils import six

from cropduster.files import ImageFile
from cropduster.utils import json
Expand Down
5 changes: 3 additions & 2 deletions cropduster/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
import math
from distutils.version import LooseVersion

import six
from six.moves import xrange

import PIL.Image
from PIL import ImageFile, JpegImagePlugin

from django.core.files.storage import default_storage
from django.utils import six
from django.utils.six.moves import xrange

from cropduster.settings import (
get_jpeg_quality, JPEG_SAVE_ICC_SUPPORTED, CROPDUSTER_GIFSICLE_PATH)
Expand Down
4 changes: 2 additions & 2 deletions cropduster/utils/jsonutils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
from django.utils import six
from django.utils.six.moves import filter
import six
from six.moves import filter

from cropduster.resizing import Size

Expand Down
2 changes: 1 addition & 1 deletion cropduster/utils/paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import os
import re

import six
from django.core.files.storage import default_storage, FileSystemStorage
from django.conf import settings
from django.db.models.fields.files import FileField
from django.utils import six


__all__ = ('get_upload_foldername')
Expand Down
2 changes: 1 addition & 1 deletion cropduster/utils/sizes.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import division

from django.utils import six
import six

from . import jsonutils as json
from ..resizing import Size
Expand Down
5 changes: 3 additions & 2 deletions cropduster/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
import shutil
import time

import six
from six.moves import filter, map, zip

import django
from django.conf import settings
from django.contrib.auth.decorators import login_required
Expand All @@ -45,8 +48,6 @@
from django.utils.decorators import method_decorator
from django.utils.encoding import force_text
from django.utils.functional import cached_property
from django.utils import six
from django.utils.six.moves import filter, map, zip
from django.views.decorators.csrf import csrf_exempt

import PIL.Image
Expand Down
3 changes: 1 addition & 2 deletions cropduster/views/base.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
from functools import update_wrapper

from logging import getLogger

import six
from django import http
from django.utils.decorators import classonlymethod
from django.utils import six


logger = getLogger('django.request')
Expand Down
2 changes: 1 addition & 1 deletion cropduster/views/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
import hashlib

import six
import PIL.Image

from django import forms
Expand All @@ -16,7 +17,6 @@
from django.utils.html import conditional_escape
from django.utils.safestring import mark_safe
from django.templatetags.static import static
from django.utils import six

from cropduster.models import Thumb
from cropduster.utils import (json, get_upload_foldername, get_min_size,
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
license='BSD',
platforms='any',
install_requires=[
'six',
'Pillow',
'python-xmp-toolkit',
'django-generic-plus>=2.0.3',
Expand All @@ -37,7 +38,7 @@
"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',
])
10 changes: 5 additions & 5 deletions tests/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import six
from django.db import models
from django.utils.encoding import python_2_unicode_compatible

from cropduster.fields import ReverseForeignRelation
from cropduster.models import CropDusterField, Size
Expand Down Expand Up @@ -76,7 +76,7 @@ class MultipleFieldsInheritanceChild(MultipleFieldsInheritanceParent):
field_identifier="2")


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class ReverseForeignRelA(models.Model):
slug = models.SlugField()
c = models.ForeignKey('ReverseForeignRelC', on_delete=models.CASCADE)
Expand All @@ -90,7 +90,7 @@ def __str__(self):
return self.slug


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class ReverseForeignRelB(models.Model):
slug = models.SlugField()
c = models.ForeignKey('ReverseForeignRelC', on_delete=models.CASCADE)
Expand All @@ -99,7 +99,7 @@ def __str__(self):
return self.slug


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class ReverseForeignRelC(models.Model):
slug = models.SlugField()
rel_a = ReverseForeignRelation(
Expand All @@ -110,7 +110,7 @@ def __str__(self):
return self.slug


@python_2_unicode_compatible
@six.python_2_unicode_compatible
class ReverseForeignRelM2M(models.Model):
slug = models.SlugField()
m2m = models.ManyToManyField(ReverseForeignRelC)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import os
import PIL

from six.moves import range
from django.core.files.storage import default_storage
from django.test import TestCase, override_settings
from django.contrib.contenttypes.models import ContentType
from django.utils.six.moves import range

from .helpers import CropdusterTestCaseMediaMixin
from .models import (
Expand Down
7 changes: 6 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ deps =
pytest-cov
pytest-django
selenium
django-selenosis
django-selenosis>=1.3.0
boto3==1.12.18
django-storages==1.9.1
dj111: Django>=1.11a1,<1.11.99
Expand All @@ -54,6 +54,11 @@ deps =
dj30-grp: django-grappelli==2.14.3
dj31-grp: django-grappelli==2.14.3
lxml
-e git+https://github.com/theatlantic/django-ckeditor.git@b0b68f46c6c917faae14057d4c5458feaeaf19d3#egg=django-ckeditor

[testenv:py27-dj111-{grp,nogrp}]
deps =
{[testenv]deps}
-e git+https://github.com/theatlantic/[email protected]+atl.6.1#egg=django-ckeditor

[testenv:coverage-report]
Expand Down

0 comments on commit 15c30d2

Please sign in to comment.