Fixed IKModel.delete file locking bug

This commit is contained in:
Justin Driscoll 2009-01-09 09:34:44 -05:00
parent 0dfabd1d7b
commit 8a0bd9c5a9
2 changed files with 5 additions and 3 deletions

View file

@ -49,9 +49,10 @@ class IKModel(models.Model):
pass
def admin_thumbnail_view(self):
prop = getattr(self, 'admin_thumbnail', None)
prop = getattr(self, self._ik.admin_thumbnail_spec, None)
if prop is None:
return 'An "admin_thumbnail" image spec has not been defined.'
return 'An "%s" image spec has not been defined.' % \
self._ik.admin_thumbnail_spec
else:
if hasattr(self, 'get_absolute_url'):
return u'<a href="%s"><img src="%s"></a>' % \
@ -106,4 +107,4 @@ class IKModel(models.Model):
def delete(self):
assert self._get_pk_val() is not None, "%s object can't be deleted because its %s attribute is set to None." % (self._meta.object_name, self._meta.pk.attname)
self._clear_cache()
super(IKModel, self).delete()
models.Model.delete(self)

View file

@ -14,6 +14,7 @@ class Options(object):
cache_dir = 'images'
save_count_as = None
cache_filename_format = "%(filename)s_%(specname)s.%(extension)s"
admin_thumbnail_spec = 'admin_thumbnail'
spec_module = 'imagekit.config'
def __init__(self, opts):