mirror of
https://github.com/Hopiu/django-imagekit.git
synced 2026-05-03 10:54:43 +00:00
Fixed a couple issues with having an optional (and empty) image field in an ImageModel
This commit is contained in:
parent
e0a2ad9ede
commit
9c455a19c5
1 changed files with 3 additions and 1 deletions
|
|
@ -73,6 +73,8 @@ class ImageModel(models.Model):
|
|||
pass
|
||||
|
||||
def admin_thumbnail_view(self):
|
||||
if not self._imgfield:
|
||||
return 'None'
|
||||
prop = getattr(self, self._ik.admin_thumbnail_spec, None)
|
||||
if prop is None:
|
||||
return 'An "%s" image spec has not been defined.' % \
|
||||
|
|
@ -124,7 +126,7 @@ class ImageModel(models.Model):
|
|||
name = str(self._imgfield)
|
||||
self._imgfield.storage.delete(name)
|
||||
self._imgfield.storage.save(name, content)
|
||||
if clear_cache:
|
||||
if clear_cache and self._imgfield != '':
|
||||
self._clear_cache()
|
||||
self._pre_cache()
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue