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

@ -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
)