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

Introduce TenantColumn to simplify representation

This commit is contained in:
Jeremy Stretch
2021-03-04 16:07:55 -05:00
parent 23b58ccbe8
commit 20a85c1ef2
7 changed files with 48 additions and 77 deletions

View File

@@ -5,7 +5,7 @@ from dcim.models import (
ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem, Platform,
PowerOutlet, PowerPort, RearPort, VirtualChassis,
)
from tenancy.tables import COL_TENANT
from tenancy.tables import TenantColumn
from utilities.tables import (
BaseTable, BooleanColumn, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn,
TagColumn, ToggleColumn,
@@ -109,9 +109,7 @@ class DeviceTable(BaseTable):
template_code=DEVICE_LINK
)
status = ChoiceFieldColumn()
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
tenant = TenantColumn()
site = tables.Column(
linkify=True
)
@@ -178,9 +176,7 @@ class DeviceImportTable(BaseTable):
template_code=DEVICE_LINK
)
status = ChoiceFieldColumn()
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
tenant = TenantColumn()
site = tables.Column(
linkify=True
)

View File

@@ -2,7 +2,7 @@ import django_tables2 as tables
from django_tables2.utils import Accessor
from dcim.models import Rack, Location, RackReservation, RackRole
from tenancy.tables import COL_TENANT
from tenancy.tables import TenantColumn
from utilities.tables import (
BaseTable, ButtonsColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn, TagColumn,
ToggleColumn,
@@ -79,9 +79,7 @@ class RackTable(BaseTable):
site = tables.Column(
linkify=True
)
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
tenant = TenantColumn()
status = ChoiceFieldColumn()
role = ColoredLabelColumn()
u_height = tables.TemplateColumn(
@@ -143,9 +141,7 @@ class RackReservationTable(BaseTable):
accessor=Accessor('rack__site'),
linkify=True
)
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
tenant = TenantColumn()
rack = tables.Column(
linkify=True
)

View File

@@ -1,7 +1,7 @@
import django_tables2 as tables
from dcim.models import Region, Site
from tenancy.tables import COL_TENANT
from tenancy.tables import TenantColumn
from utilities.tables import BaseTable, ButtonsColumn, ChoiceFieldColumn, TagColumn, ToggleColumn
from .template_code import MPTT_LINK
@@ -46,9 +46,7 @@ class SiteTable(BaseTable):
region = tables.Column(
linkify=True
)
tenant = tables.TemplateColumn(
template_code=COL_TENANT
)
tenant = TenantColumn()
tags = TagColumn(
url_name='dcim:site_list'
)