diff options
author | Philip Sargent <philip@Muscogee.localdomain> | 2020-05-24 01:57:06 +0100 |
---|---|---|
committer | Wookey <wookey@wookware.org> | 2020-05-24 20:56:27 +0100 |
commit | 50d753a87b5f6bc4fe31e222a37796cf903133f7 (patch) | |
tree | 885b01fa921893684b602c20392c1ef995e13482 /imagekit/models.py | |
parent | 35f85c55f14e707e37d822041e25bca2913f48c4 (diff) | |
download | troggle-50d753a87b5f6bc4fe31e222a37796cf903133f7.tar.gz troggle-50d753a87b5f6bc4fe31e222a37796cf903133f7.tar.bz2 troggle-50d753a87b5f6bc4fe31e222a37796cf903133f7.zip |
Convert codebase for python3 usage
Diffstat (limited to 'imagekit/models.py')
-rw-r--r-- | imagekit/models.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/imagekit/models.py b/imagekit/models.py index 140715e..0eba0ab 100644 --- a/imagekit/models.py +++ b/imagekit/models.py @@ -47,7 +47,7 @@ class ImageModelBase(ModelBase): except ImportError: raise ImportError('Unable to load imagekit config module: %s' % \ opts.spec_module) - for spec in [spec for spec in module.__dict__.values() \ + for spec in [spec for spec in list(module.__dict__.values()) \ if isinstance(spec, type) \ and issubclass(spec, specs.ImageSpec) \ and spec != specs.ImageSpec]: @@ -56,7 +56,7 @@ class ImageModelBase(ModelBase): setattr(cls, '_ik', opts) -class ImageModel(models.Model): +class ImageModel(models.Model, metaclass=ImageModelBase): """ Abstract base class implementing all core ImageKit functionality Subclasses of ImageModel are augmented with accessors for each defined @@ -64,7 +64,6 @@ class ImageModel(models.Model): storage locations and other options. """ - __metaclass__ = ImageModelBase class Meta: abstract = True @@ -81,10 +80,10 @@ class ImageModel(models.Model): self._ik.admin_thumbnail_spec else: if hasattr(self, 'get_absolute_url'): - return u'<a href="%s"><img src="%s"></a>' % \ + return '<a href="%s"><img src="%s"></a>' % \ (self.get_absolute_url(), prop.url) else: - return u'<a href="%s"><img src="%s"></a>' % \ + return '<a href="%s"><img src="%s"></a>' % \ (self._imgfield.url, prop.url) admin_thumbnail_view.short_description = _('Thumbnail') admin_thumbnail_view.allow_tags = True |