From 5c263fac8d25296940f9d84a781b81569c3c1513 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Thu, 3 Jun 2021 20:31:09 -0400 Subject: [PATCH] Closes #6540: Add a 'flat' column to the prefix table --- docs/release-notes/version-2.11.md | 1 + netbox/ipam/tables.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/docs/release-notes/version-2.11.md b/docs/release-notes/version-2.11.md index efc68c1a9..75f8662cd 100644 --- a/docs/release-notes/version-2.11.md +++ b/docs/release-notes/version-2.11.md @@ -8,6 +8,7 @@ * [#6487](https://github.com/netbox-community/netbox/issues/6487) - Add location filter to cable connection form * [#6501](https://github.com/netbox-community/netbox/issues/6501) - Expose prefix depth and children on REST API serializer * [#6527](https://github.com/netbox-community/netbox/issues/6527) - Support Markdown for report descriptions +* [#6540](https://github.com/netbox-community/netbox/issues/6540) - Add a "flat" column to the prefix table ### Bug Fixes diff --git a/netbox/ipam/tables.py b/netbox/ipam/tables.py index 740441b42..c564985f7 100644 --- a/netbox/ipam/tables.py +++ b/netbox/ipam/tables.py @@ -262,6 +262,11 @@ class PrefixTable(BaseTable): template_code=PREFIX_LINK, attrs={'td': {'class': 'text-nowrap'}} ) + prefix_flat = tables.Column( + accessor=Accessor('prefix'), + linkify=True, + verbose_name='Prefix (Flat)' + ) depth = tables.Column( accessor=Accessor('_depth'), verbose_name='Depth' @@ -300,8 +305,8 @@ class PrefixTable(BaseTable): class Meta(BaseTable.Meta): model = Prefix fields = ( - 'pk', 'prefix', 'status', 'depth', 'children', 'vrf', 'tenant', 'site', 'vlan', 'role', 'is_pool', - 'description', + 'pk', 'prefix', 'prefix_flat', 'status', 'depth', 'children', 'vrf', 'tenant', 'site', 'vlan', 'role', + 'is_pool', 'description', ) default_columns = ('pk', 'prefix', 'status', 'vrf', 'tenant', 'site', 'vlan', 'role', 'description') row_attrs = { @@ -314,15 +319,14 @@ class PrefixDetailTable(PrefixTable): accessor='get_utilization', orderable=False ) - tenant = TenantColumn() tags = TagColumn( url_name='ipam:prefix_list' ) class Meta(PrefixTable.Meta): fields = ( - 'pk', 'prefix', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', 'is_pool', - 'description', 'tags', + 'pk', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', + 'is_pool', 'description', 'tags', ) default_columns = ( 'pk', 'prefix', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', 'description',