Skip to content

Commit

Permalink
Use six.python_2_unicode_compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
David Krauth committed Jul 16, 2020
1 parent 90b8aa2 commit e8c275e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions cropduster/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
5 changes: 2 additions & 3 deletions cropduster/resizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
10 changes: 5 additions & 5 deletions cropduster/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 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)
Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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)
Expand Down

0 comments on commit e8c275e

Please sign in to comment.