show preview

This commit is contained in:
j 2025-02-26 16:41:41 +01:00
commit 347433ceb6
2 changed files with 7 additions and 0 deletions

View file

@ -240,6 +240,12 @@ class Item(models.Model):
self.data["hue"] = hue
return hue
def preview(self):
from django.utils.html import escape, mark_safe
if "thumbnail" in self.data:
return mark_safe('<img src="%s" style="max-width:100%%" />' % escape(self.data["thumbnail"]))
return ""
class Comment(models.Model):
created = models.DateTimeField(auto_now_add=True)