From a09bc45d708e6c89e983400fa63df2b8cc2e642f Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Wed, 8 Nov 2023 22:35:00 +0530 Subject: [PATCH 1/2] adds site column to power feeds #13743 --- netbox/dcim/tables/power.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/netbox/dcim/tables/power.py b/netbox/dcim/tables/power.py index e4735bd579..04aa9a2d6d 100644 --- a/netbox/dcim/tables/power.py +++ b/netbox/dcim/tables/power.py @@ -87,6 +87,10 @@ class PowerFeedTable(TenancyColumnsMixin, CableTerminationTable): linkify=True, verbose_name=_('Tenant') ) + site = tables.TemplateColumn( + template_code='''{% if record.rack %}{{ record.rack.site|linkify }}{% else %}—{% endif %}''', + verbose_name=_('Site'), + ) comments = columns.MarkdownColumn( verbose_name=_('Comments'), ) @@ -97,9 +101,9 @@ class PowerFeedTable(TenancyColumnsMixin, CableTerminationTable): class Meta(NetBoxTable.Meta): model = PowerFeed fields = ( - 'pk', 'id', 'name', 'power_panel', 'rack', 'status', 'type', 'supply', 'voltage', 'amperage', 'phase', - 'max_utilization', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'available_power', 'tenant', - 'tenant_group', 'description', 'comments', 'tags', 'created', 'last_updated', + 'pk', 'id', 'name', 'power_panel', 'site', 'rack', 'status', 'type', 'supply', 'voltage', 'amperage', + 'phase', 'max_utilization', 'mark_connected', 'cable', 'cable_color', 'link_peer', 'available_power', + 'tenant', 'tenant_group', 'description', 'comments', 'tags', 'created', 'last_updated', ) default_columns = ( 'pk', 'name', 'power_panel', 'rack', 'status', 'type', 'supply', 'voltage', 'amperage', 'phase', 'cable', From 23c74519381d34bb0964fbfc936670baf58b8fe7 Mon Sep 17 00:00:00 2001 From: Abhimanyu Saharan Date: Thu, 9 Nov 2023 02:54:56 +0530 Subject: [PATCH 2/2] review changes #13743 --- netbox/dcim/tables/power.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/tables/power.py b/netbox/dcim/tables/power.py index 04aa9a2d6d..40a58ad816 100644 --- a/netbox/dcim/tables/power.py +++ b/netbox/dcim/tables/power.py @@ -87,8 +87,9 @@ class PowerFeedTable(TenancyColumnsMixin, CableTerminationTable): linkify=True, verbose_name=_('Tenant') ) - site = tables.TemplateColumn( - template_code='''{% if record.rack %}{{ record.rack.site|linkify }}{% else %}—{% endif %}''', + site = tables.Column( + accessor='rack__site', + linkify=True, verbose_name=_('Site'), ) comments = columns.MarkdownColumn(