diff --git a/cropduster/models.py b/cropduster/models.py index 96682e9b..3f0e5d4e 100644 --- a/cropduster/models.py +++ b/cropduster/models.py @@ -15,7 +15,6 @@ from django.contrib.contenttypes.fields import GenericForeignKey from django.contrib.contenttypes.models import ContentType from django.db import connection, models -from django.utils.encoding import python_2_unicode_compatible from django.core.files.storage import default_storage, FileSystemStorage import PIL.Image @@ -45,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) @@ -214,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) diff --git a/cropduster/resizing.py b/cropduster/resizing.py index 140341a1..a9c82088 100644 --- a/cropduster/resizing.py +++ b/cropduster/resizing.py @@ -11,7 +11,6 @@ import PIL.Image from django.core.exceptions import ImproperlyConfigured -from django.utils.encoding import python_2_unicode_compatible from django.core.files.storage import default_storage from .settings import CROPDUSTER_RETAIN_METADATA @@ -23,7 +22,7 @@ INFINITY = float('inf') -@python_2_unicode_compatible +@six.python_2_unicode_compatible class SizeAlias(object): is_alias = True @@ -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 diff --git a/cropduster/tests/models.py b/cropduster/tests/models.py index 400eab83..c3c05539 100644 --- a/cropduster/tests/models.py +++ b/cropduster/tests/models.py @@ -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 @@ -76,7 +76,7 @@ class TestMultipleFieldsInheritanceChild(TestMultipleFieldsInheritanceParent): field_identifier="2") -@python_2_unicode_compatible +@six.python_2_unicode_compatible class TestReverseForeignRelA(models.Model): slug = models.SlugField() c = models.ForeignKey('TestReverseForeignRelC', on_delete=models.CASCADE) @@ -90,7 +90,7 @@ def __str__(self): return self.slug -@python_2_unicode_compatible +@six.python_2_unicode_compatible class TestReverseForeignRelB(models.Model): slug = models.SlugField() c = models.ForeignKey('TestReverseForeignRelC', on_delete=models.CASCADE) @@ -99,7 +99,7 @@ def __str__(self): return self.slug -@python_2_unicode_compatible +@six.python_2_unicode_compatible class TestReverseForeignRelC(models.Model): slug = models.SlugField() rel_a = ReverseForeignRelation( @@ -110,7 +110,7 @@ def __str__(self): return self.slug -@python_2_unicode_compatible +@six.python_2_unicode_compatible class TestReverseForeignRelM2M(models.Model): slug = models.SlugField() m2m = models.ManyToManyField(TestReverseForeignRelC)