diff --git a/netbox/core/tables/columns.py b/netbox/core/tables/columns.py new file mode 100644 index 000000000..93f1e3901 --- /dev/null +++ b/netbox/core/tables/columns.py @@ -0,0 +1,20 @@ +import django_tables2 as tables + +from netbox.registry import registry + +__all__ = ( + 'BackendTypeColumn', +) + + +class BackendTypeColumn(tables.Column): + """ + Display a data backend type. + """ + def render(self, value): + if backend := registry['data_backends'].get(value): + return backend.label + return value + + def value(self, value): + return value diff --git a/netbox/core/tables/data.py b/netbox/core/tables/data.py index a1b608547..4059ea9bc 100644 --- a/netbox/core/tables/data.py +++ b/netbox/core/tables/data.py @@ -3,6 +3,7 @@ import django_tables2 as tables from core.models import * from netbox.tables import NetBoxTable, columns +from .columns import BackendTypeColumn __all__ = ( 'DataFileTable', @@ -15,6 +16,9 @@ class DataSourceTable(NetBoxTable): verbose_name=_('Name'), linkify=True ) + type = BackendTypeColumn( + verbose_name=_('Type') + ) status = columns.ChoiceFieldColumn( verbose_name=_('Status'), )