mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-03-17 05:40:25 +00:00
Before this is applied, we're going to have to make it so that the image cache strategies are passed the source file, not the other file.
19 lines
576 B
Python
19 lines
576 B
Python
from .files import ImageSpecFieldFile
|
|
|
|
|
|
class ImageSpecFileDescriptor(object):
|
|
def __init__(self, field, attname):
|
|
self.attname = attname
|
|
self.field = field
|
|
|
|
def __get__(self, instance, owner):
|
|
if instance is None:
|
|
return self.field
|
|
else:
|
|
img_spec_file = ImageSpecFieldFile(instance, self.field,
|
|
self.attname)
|
|
instance.__dict__[self.attname] = img_spec_file
|
|
return img_spec_file
|
|
|
|
def __set__(self, instance, value):
|
|
instance.__dict__[self.attname] = value
|