mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Show human-friendly values for file size
This commit is contained in:
parent
4e0e4598b0
commit
70f746fe4f
@ -1,6 +1,7 @@
|
|||||||
import json
|
import json
|
||||||
|
|
||||||
import django_tables2 as tables
|
import django_tables2 as tables
|
||||||
|
from django.template.defaultfilters import filesizeformat
|
||||||
from django.utils.html import format_html
|
from django.utils.html import format_html
|
||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
|
|
||||||
@ -254,6 +255,12 @@ class ImageAttachmentTable(NetBoxTable):
|
|||||||
)
|
)
|
||||||
default_columns = ('object_type', 'parent', 'image', 'name', 'description', 'size', 'created')
|
default_columns = ('object_type', 'parent', 'image', 'name', 'description', 'size', 'created')
|
||||||
|
|
||||||
|
def render_size(self, value):
|
||||||
|
return filesizeformat(value)
|
||||||
|
|
||||||
|
def value_size(self, value):
|
||||||
|
return value
|
||||||
|
|
||||||
|
|
||||||
class SavedFilterTable(NetBoxTable):
|
class SavedFilterTable(NetBoxTable):
|
||||||
name = tables.Column(
|
name = tables.Column(
|
||||||
|
Loading…
Reference in New Issue
Block a user