Explorar el Código

Closes #6540: Add a 'flat' column to the prefix table

jeremystretch hace 4 años
padre
commit
5c263fac8d
Se han modificado 2 ficheros con 10 adiciones y 5 borrados
  1. 1 0
      docs/release-notes/version-2.11.md
  2. 9 5
      netbox/ipam/tables.py

+ 1 - 0
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
 

+ 9 - 5
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',