mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-26 01:06:11 -06:00
adds image preview on image attachment #12627
This commit is contained in:
parent
bf1c191b2e
commit
da9c5572bf
@ -22,6 +22,14 @@ __all__ = (
|
||||
'WebhookTable',
|
||||
)
|
||||
|
||||
IMAGEATTACHMENT_IMAGE = '''
|
||||
{% if record.image %}
|
||||
<a class="image-preview" href="{{ record.image.url }}" target="_blank">{{ record }}</a>
|
||||
{% 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)'
|
||||
|
Loading…
Reference in New Issue
Block a user