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

Replace TenantColumn with new TenancyColumnsMixin

Replaces all usages of the TenantColumn with the new TenancyColumnsMixin.

This enables the user to add a column for Tenant Group on all tables which
also has a column for Tenant.
This commit is contained in:
Kim Johansson
2022-07-10 15:13:48 +02:00
parent bd60d46b82
commit e6bfde1397
10 changed files with 50 additions and 71 deletions

View File

@@ -1,6 +1,7 @@
import django_tables2 as tables
from netbox.tables import NetBoxTable, columns
from tenancy.tables import TenancyColumnsMixin
from virtualization.models import Cluster, ClusterGroup, ClusterType
__all__ = (
@@ -56,7 +57,7 @@ class ClusterGroupTable(NetBoxTable):
default_columns = ('pk', 'name', 'cluster_count', 'description')
class ClusterTable(NetBoxTable):
class ClusterTable(TenancyColumnsMixin, NetBoxTable):
name = tables.Column(
linkify=True
)
@@ -66,9 +67,6 @@ class ClusterTable(NetBoxTable):
group = tables.Column(
linkify=True
)
tenant = tables.Column(
linkify=True
)
site = tables.Column(
linkify=True
)
@@ -93,7 +91,7 @@ class ClusterTable(NetBoxTable):
class Meta(NetBoxTable.Meta):
model = Cluster
fields = (
'pk', 'id', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'contacts',
'pk', 'id', 'name', 'type', 'group', 'tenant', 'tenant_group', 'site', 'comments', 'device_count', 'vm_count', 'contacts',
'tags', 'created', 'last_updated',
)
default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'device_count', 'vm_count')