django-imagekit/imagekit/options.py

37 lines
1.1 KiB
Python
Raw Normal View History

2009-01-04 18:42:25 +00:00
# Imagekit options
2009-01-08 20:04:20 +00:00
from imagekit import processors
from imagekit.specs import ImageSpec
2009-12-19 16:01:54 +00:00
2009-01-04 18:42:25 +00:00
class Options(object):
""" Class handling per-model imagekit options
"""
2011-09-08 20:50:06 +00:00
admin_thumbnail_property = 'admin_thumbnail'
"""The name of the spec to be used by the admin_thumbnail_view"""
default_image_field = None
"""The name of the image field property on the model.
Can be overridden on a per-spec basis by setting the image_field property on
the spec. If you don't define default_image_field on your IKOptions class,
it will be automatically populated with the name of the first ImageField the
model defines.
"""
2009-01-08 18:37:15 +00:00
crop_horz_field = 'crop_horz'
crop_vert_field = 'crop_vert'
2009-01-08 21:11:15 +00:00
preprocessor_spec = None
cache_dir = 'cache'
2009-01-04 18:42:25 +00:00
save_count_as = None
cache_filename_fields = ['pk', ]
2009-01-04 18:42:25 +00:00
cache_filename_format = "%(filename)s_%(specname)s.%(extension)s"
specs = None
#storage = defaults to image_field.storage
2009-12-19 16:01:54 +00:00
def __init__(self, opts):
2009-01-04 18:42:25 +00:00
for key, value in opts.__dict__.iteritems():
setattr(self, key, value)
self.specs = list(self.specs or [])