From da9c5572bf9d1128cc11562cf80c1eaa683cafe4 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Thu, 25 May 2023 23:45:04 +0530 Subject: [PATCH] adds image preview on image attachment #12627 --- netbox/extras/tables/tables.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/netbox/extras/tables/tables.py b/netbox/extras/tables/tables.py index 8d046b85d..9e4924532 100644 --- a/netbox/extras/tables/tables.py +++ b/netbox/extras/tables/tables.py @@ -22,6 +22,14 @@ __all__ = ( 'WebhookTable', ) +IMAGEATTACHMENT_IMAGE = ''' +{% if record.image %} + {{ record }} +{% else %} + — +{% endif %} +''' + class CustomFieldTable(NetBoxTable): name = tables.Column( @@ -96,6 +104,9 @@ class ImageAttachmentTable(NetBoxTable): parent = tables.Column( linkify=True ) + image = tables.TemplateColumn( + template_code=IMAGEATTACHMENT_IMAGE, + ) size = tables.Column( orderable=False, verbose_name='Size (bytes)'