1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Table mixin for Tenancy columns

A mixin to add the Tenant and Tenant Group columns to a table.
This commit is contained in:
Kim Johansson
2022-07-10 15:08:55 +02:00
parent 3c2a55a521
commit bd60d46b82

View File

@ -3,6 +3,7 @@ import django_tables2 as tables
__all__ = ( __all__ = (
'TenantColumn', 'TenantColumn',
'TenantGroupColumn', 'TenantGroupColumn',
'TenancyColumnsMixin',
) )
@ -50,3 +51,7 @@ class TenantGroupColumn(tables.TemplateColumn):
def value(self, value): def value(self, value):
return str(value) if value else None return str(value) if value else None
class TenancyColumnsMixin(tables.Table):
tenant_group = TenantGroupColumn()
tenant = TenantColumn()