Skip to content

Commit

Permalink
Update admin.py
Browse files Browse the repository at this point in the history
  • Loading branch information
danieleguido committed Nov 28, 2024
1 parent dabdebb commit fcfef3e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions miller/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,11 +179,12 @@ def thumbnail(self, instance):
return mark_safe("⚠️ attachment <b>not found</b>")
return ""
thumbnail = resolutions.get("thumbnail", {})
if not thumbnail:
url = thumbnail.get("url", "")
width = thumbnail.get("width", 0)
height = thumbnail.get("height", 0)
if not url:
return ""
return mark_safe(
'<img src="{url}" width="{width}" height="{height}" />'.format(**thumbnail)
)
return mark_safe(f'<img src="{url}" width="{width}" height="{height}" />')

thumbnail.__name__ = "Thumbnail"

Expand Down

0 comments on commit fcfef3e

Please sign in to comment.