fix add photo
This commit is contained in:
parent
6a4319220d
commit
2c4d108715
1 changed files with 3 additions and 1 deletions
|
@ -281,7 +281,9 @@ class ImageModel(models.Model):
|
|||
if func is None:
|
||||
return _('An "admin_thumbnail" photo size has not been defined.')
|
||||
else:
|
||||
if hasattr(self, 'get_absolute_url'):
|
||||
if not self.id:
|
||||
return ""
|
||||
elif hasattr(self, 'get_absolute_url'):
|
||||
return mark_safe(f'<a href="{self.get_absolute_url()}"><img src="{func()}"></a>')
|
||||
else:
|
||||
return mark_safe(f'<a href="{self.image.url}"><img src="{func()}"></a>')
|
||||
|
|
Loading…
Add table
Reference in a new issue