From ae9611aa394bd2c730ff0553d49ee9cceb939e5c Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:13:53 -0400 Subject: [PATCH 01/14] netbox-community/netbox#6930: Add ID column to devices, device types, and components --- netbox/dcim/tables/devices.py | 64 ++++++++++++++++++++----------- netbox/dcim/tables/devicetypes.py | 13 ++++++- 2 files changed, 54 insertions(+), 23 deletions(-) diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index c22e673b78c..86d88650b20 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -69,6 +69,10 @@ def get_interface_state_attribute(record): class DeviceRoleTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) name = tables.Column( linkify=True ) @@ -88,7 +92,7 @@ class DeviceRoleTable(BaseTable): class Meta(BaseTable.Meta): model = DeviceRole - fields = ('pk', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'device_count', 'vm_count', 'color', 'vm_role', 'description', 'actions') @@ -98,6 +102,10 @@ class Meta(BaseTable.Meta): class PlatformTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) name = tables.Column( linkify=True ) @@ -116,7 +124,7 @@ class PlatformTable(BaseTable): class Meta(BaseTable.Meta): model = Platform fields = ( - 'pk', 'name', 'manufacturer', 'device_count', 'vm_count', 'slug', 'napalm_driver', 'napalm_args', + 'pk', 'id', 'name', 'manufacturer', 'device_count', 'vm_count', 'slug', 'napalm_driver', 'napalm_args', 'description', 'actions', ) default_columns = ( @@ -130,6 +138,10 @@ class Meta(BaseTable.Meta): class DeviceTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.TemplateColumn( order_by=('_name',), template_code=DEVICE_LINK @@ -196,7 +208,7 @@ class DeviceTable(BaseTable): class Meta(BaseTable.Meta): model = Device fields = ( - 'pk', 'name', 'status', 'tenant', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial', + 'pk', 'id', 'name', 'status', 'tenant', 'device_role', 'manufacturer', 'device_type', 'platform', 'serial', 'asset_tag', 'site', 'location', 'rack', 'position', 'face', 'primary_ip', 'primary_ip4', 'primary_ip6', 'cluster', 'virtual_chassis', 'vc_position', 'vc_priority', 'comments', 'tags', ) @@ -237,6 +249,10 @@ class Meta(BaseTable.Meta): class DeviceComponentTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) device = tables.Column( linkify=True ) @@ -290,7 +306,7 @@ class ConsolePortTable(DeviceComponentTable, PathEndpointTable): class Meta(DeviceComponentTable.Meta): model = ConsolePort fields = ( - 'pk', 'name', 'device', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', + 'pk', 'id', 'name', 'device', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description') @@ -311,7 +327,7 @@ class DeviceConsolePortTable(ConsolePortTable): class Meta(DeviceComponentTable.Meta): model = ConsolePort fields = ( - 'pk', 'name', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', + 'pk', 'id', 'name', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'actions' ) default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection', 'actions') @@ -334,7 +350,7 @@ class ConsoleServerPortTable(DeviceComponentTable, PathEndpointTable): class Meta(DeviceComponentTable.Meta): model = ConsoleServerPort fields = ( - 'pk', 'name', 'device', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', + 'pk', 'id', 'name', 'device', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'speed', 'description') @@ -356,7 +372,7 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable): class Meta(DeviceComponentTable.Meta): model = ConsoleServerPort fields = ( - 'pk', 'name', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', + 'pk', 'id', 'name', 'label', 'type', 'speed', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'actions', ) default_columns = ('pk', 'name', 'label', 'type', 'speed', 'description', 'cable', 'connection', 'actions') @@ -379,7 +395,7 @@ class PowerPortTable(DeviceComponentTable, PathEndpointTable): class Meta(DeviceComponentTable.Meta): model = PowerPort fields = ( - 'pk', 'name', 'device', 'label', 'type', 'description', 'mark_connected', 'maximum_draw', 'allocated_draw', + 'pk', 'id', 'name', 'device', 'label', 'type', 'description', 'mark_connected', 'maximum_draw', 'allocated_draw', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description') @@ -401,7 +417,7 @@ class DevicePowerPortTable(PowerPortTable): class Meta(DeviceComponentTable.Meta): model = PowerPort fields = ( - 'pk', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'mark_connected', 'cable', + 'pk', 'id', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'actions', ) default_columns = ( @@ -430,7 +446,7 @@ class PowerOutletTable(DeviceComponentTable, PathEndpointTable): class Meta(DeviceComponentTable.Meta): model = PowerOutlet fields = ( - 'pk', 'name', 'device', 'label', 'type', 'description', 'power_port', 'feed_leg', 'mark_connected', 'cable', + 'pk', 'id', 'name', 'device', 'label', 'type', 'description', 'power_port', 'feed_leg', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'power_port', 'feed_leg', 'description') @@ -451,7 +467,7 @@ class DevicePowerOutletTable(PowerOutletTable): class Meta(DeviceComponentTable.Meta): model = PowerOutlet fields = ( - 'pk', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'mark_connected', 'cable', + 'pk', 'id', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'actions', ) default_columns = ( @@ -492,7 +508,7 @@ class InterfaceTable(DeviceComponentTable, BaseInterfaceTable, PathEndpointTable class Meta(DeviceComponentTable.Meta): model = Interface fields = ( - 'pk', 'name', 'device', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', + 'pk', 'id', 'name', 'device', 'label', 'enabled', 'type', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', ) @@ -524,7 +540,7 @@ class DeviceInterfaceTable(InterfaceTable): class Meta(DeviceComponentTable.Meta): model = Interface fields = ( - 'pk', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mgmt_only', 'mtu', 'mode', 'mac_address', + 'pk', 'id', 'name', 'label', 'enabled', 'type', 'parent', 'lag', 'mgmt_only', 'mtu', 'mode', 'mac_address', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions', ) @@ -561,7 +577,7 @@ class FrontPortTable(DeviceComponentTable, CableTerminationTable): class Meta(DeviceComponentTable.Meta): model = FrontPort fields = ( - 'pk', 'name', 'device', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'description', + 'pk', 'id', 'name', 'device', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'tags', ) default_columns = ( @@ -585,7 +601,7 @@ class DeviceFrontPortTable(FrontPortTable): class Meta(DeviceComponentTable.Meta): model = FrontPort fields = ( - 'pk', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'description', 'mark_connected', 'cable', + 'pk', 'id', 'name', 'label', 'type', 'rear_port', 'rear_port_position', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'tags', 'actions', ) default_columns = ( @@ -612,7 +628,7 @@ class RearPortTable(DeviceComponentTable, CableTerminationTable): class Meta(DeviceComponentTable.Meta): model = RearPort fields = ( - 'pk', 'name', 'device', 'label', 'type', 'color', 'positions', 'description', 'mark_connected', 'cable', + 'pk', 'id', 'name', 'device', 'label', 'type', 'color', 'positions', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'type', 'color', 'description') @@ -634,7 +650,7 @@ class DeviceRearPortTable(RearPortTable): class Meta(DeviceComponentTable.Meta): model = RearPort fields = ( - 'pk', 'name', 'label', 'type', 'positions', 'description', 'mark_connected', 'cable', 'cable_color', + 'pk', 'id', 'name', 'label', 'type', 'positions', 'description', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'tags', 'actions', ) default_columns = ( @@ -664,7 +680,7 @@ class DeviceBayTable(DeviceComponentTable): class Meta(DeviceComponentTable.Meta): model = DeviceBay - fields = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description', 'tags') + fields = ('pk', 'id', 'name', 'device', 'label', 'status', 'installed_device', 'description', 'tags') default_columns = ('pk', 'name', 'device', 'label', 'status', 'installed_device', 'description') @@ -684,7 +700,7 @@ class DeviceDeviceBayTable(DeviceBayTable): class Meta(DeviceComponentTable.Meta): model = DeviceBay fields = ( - 'pk', 'name', 'label', 'status', 'installed_device', 'description', 'tags', 'actions', + 'pk', 'id', 'name', 'label', 'status', 'installed_device', 'description', 'tags', 'actions', ) default_columns = ( 'pk', 'name', 'label', 'status', 'installed_device', 'description', 'actions', @@ -710,7 +726,7 @@ class InventoryItemTable(DeviceComponentTable): class Meta(BaseTable.Meta): model = InventoryItem fields = ( - 'pk', 'name', 'device', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', + 'pk', 'id', 'name', 'device', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'discovered', 'tags', ) default_columns = ('pk', 'name', 'device', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag') @@ -731,7 +747,7 @@ class DeviceInventoryItemTable(InventoryItemTable): class Meta(BaseTable.Meta): model = InventoryItem fields = ( - 'pk', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'discovered', + 'pk', 'id', 'name', 'label', 'manufacturer', 'part_id', 'serial', 'asset_tag', 'description', 'discovered', 'tags', 'actions', ) default_columns = ( @@ -746,6 +762,10 @@ class Meta(BaseTable.Meta): class VirtualChassisTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) name = tables.Column( linkify=True ) @@ -763,5 +783,5 @@ class VirtualChassisTable(BaseTable): class Meta(BaseTable.Meta): model = VirtualChassis - fields = ('pk', 'name', 'domain', 'master', 'member_count', 'tags') + fields = ('pk', 'id', 'name', 'domain', 'master', 'member_count', 'tags') default_columns = ('pk', 'name', 'domain', 'master', 'member_count') diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index 3b11a180b35..7f1f27e584d 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -28,6 +28,10 @@ class ManufacturerTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) name = tables.Column( linkify=True ) @@ -46,6 +50,9 @@ class ManufacturerTable(BaseTable): class Meta(BaseTable.Meta): model = Manufacturer fields = ( + 'pk', 'id', 'name', 'devicetype_count', 'inventoryitem_count', 'platform_count', 'description', 'slug', 'actions', + ) + default_columns = ( 'pk', 'name', 'devicetype_count', 'inventoryitem_count', 'platform_count', 'description', 'slug', 'actions', ) @@ -56,6 +63,10 @@ class Meta(BaseTable.Meta): class DeviceTypeTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name='ID' + ) model = tables.Column( linkify=True, verbose_name='Device Type' @@ -76,7 +87,7 @@ class DeviceTypeTable(BaseTable): class Meta(BaseTable.Meta): model = DeviceType fields = ( - 'pk', 'model', 'manufacturer', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', + 'pk', 'id', 'model', 'manufacturer', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'comments', 'instance_count', 'tags', ) default_columns = ( From 45542a4566958cf5a2276b55f959cbe74c35035b Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:20:06 -0400 Subject: [PATCH 02/14] netbox-community/netbox#6930: Add ID column to sites, racks, and tenants --- netbox/dcim/tables/racks.py | 18 +++++++++++++++--- netbox/dcim/tables/sites.py | 24 ++++++++++++++++++++---- netbox/tenancy/tables.py | 12 ++++++++++-- 3 files changed, 45 insertions(+), 9 deletions(-) diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index fcc3ed4d231..9fbda9bbd00 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -21,6 +21,10 @@ class RackRoleTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column(linkify=True) rack_count = tables.Column(verbose_name='Racks') color = ColorColumn() @@ -28,7 +32,7 @@ class RackRoleTable(BaseTable): class Meta(BaseTable.Meta): model = RackRole - fields = ('pk', 'name', 'rack_count', 'color', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'rack_count', 'color', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'rack_count', 'color', 'description', 'actions') @@ -38,6 +42,10 @@ class Meta(BaseTable.Meta): class RackTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( order_by=('_name',), linkify=True @@ -76,7 +84,7 @@ class RackTable(BaseTable): class Meta(BaseTable.Meta): model = Rack fields = ( - 'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag', 'type', + 'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'serial', 'asset_tag', 'type', 'width', 'u_height', 'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'tags', ) default_columns = ( @@ -91,6 +99,10 @@ class Meta(BaseTable.Meta): class RackReservationTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) reservation = tables.Column( accessor='pk', linkify=True @@ -115,7 +127,7 @@ class RackReservationTable(BaseTable): class Meta(BaseTable.Meta): model = RackReservation fields = ( - 'pk', 'reservation', 'site', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'tags', + 'pk', 'id', 'reservation', 'site', 'rack', 'unit_list', 'user', 'created', 'tenant', 'description', 'tags', 'actions', ) default_columns = ( diff --git a/netbox/dcim/tables/sites.py b/netbox/dcim/tables/sites.py index 37fa019a16a..03d3347d137 100644 --- a/netbox/dcim/tables/sites.py +++ b/netbox/dcim/tables/sites.py @@ -21,6 +21,10 @@ class RegionTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = MPTTColumn( linkify=True ) @@ -33,7 +37,7 @@ class RegionTable(BaseTable): class Meta(BaseTable.Meta): model = Region - fields = ('pk', 'name', 'slug', 'site_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'site_count', 'description', 'actions') default_columns = ('pk', 'name', 'site_count', 'description', 'actions') @@ -43,6 +47,10 @@ class Meta(BaseTable.Meta): class SiteGroupTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = MPTTColumn( linkify=True ) @@ -55,7 +63,7 @@ class SiteGroupTable(BaseTable): class Meta(BaseTable.Meta): model = SiteGroup - fields = ('pk', 'name', 'slug', 'site_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'site_count', 'description', 'actions') default_columns = ('pk', 'name', 'site_count', 'description', 'actions') @@ -65,6 +73,10 @@ class Meta(BaseTable.Meta): class SiteTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -84,7 +96,7 @@ class SiteTable(BaseTable): class Meta(BaseTable.Meta): model = Site fields = ( - 'pk', 'name', 'slug', 'status', 'facility', 'region', 'group', 'tenant', 'asn', 'time_zone', 'description', + 'pk', 'id', 'name', 'slug', 'status', 'facility', 'region', 'group', 'tenant', 'asn', 'time_zone', 'description', 'physical_address', 'shipping_address', 'latitude', 'longitude', 'contact_name', 'contact_phone', 'contact_email', 'comments', 'tags', ) @@ -97,6 +109,10 @@ class Meta(BaseTable.Meta): class LocationTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = MPTTColumn( linkify=True ) @@ -120,5 +136,5 @@ class LocationTable(BaseTable): class Meta(BaseTable.Meta): model = Location - fields = ('pk', 'name', 'site', 'rack_count', 'device_count', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'site', 'rack_count', 'device_count', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'site', 'rack_count', 'device_count', 'description', 'actions') diff --git a/netbox/tenancy/tables.py b/netbox/tenancy/tables.py index f39ca1b18ad..3190a65ed42 100644 --- a/netbox/tenancy/tables.py +++ b/netbox/tenancy/tables.py @@ -43,6 +43,10 @@ def value(self, value): class TenantGroupTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = MPTTColumn( linkify=True ) @@ -55,7 +59,7 @@ class TenantGroupTable(BaseTable): class Meta(BaseTable.Meta): model = TenantGroup - fields = ('pk', 'name', 'tenant_count', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'tenant_count', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'tenant_count', 'description', 'actions') @@ -65,6 +69,10 @@ class Meta(BaseTable.Meta): class TenantTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -78,5 +86,5 @@ class TenantTable(BaseTable): class Meta(BaseTable.Meta): model = Tenant - fields = ('pk', 'name', 'slug', 'group', 'description', 'comments', 'tags') + fields = ('pk', 'id', 'name', 'slug', 'group', 'description', 'comments', 'tags') default_columns = ('pk', 'name', 'group', 'description') From a02851a46bf054da20271070347faf33fbe88045 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:38:45 -0400 Subject: [PATCH 03/14] netbox-community/netbox#6930: Add ID column to power, providers, TODO circuits --- netbox/circuits/tables.py | 20 ++++++++++++++++---- netbox/dcim/tables/power.py | 12 ++++++++++-- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/netbox/circuits/tables.py b/netbox/circuits/tables.py index 2e31237b69c..708deddc2e1 100644 --- a/netbox/circuits/tables.py +++ b/netbox/circuits/tables.py @@ -29,6 +29,10 @@ class ProviderTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -44,8 +48,8 @@ class ProviderTable(BaseTable): class Meta(BaseTable.Meta): model = Provider fields = ( - 'pk', 'name', 'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'circuit_count', 'comments', - 'tags', + 'pk', 'id', 'name', 'asn', 'account', 'portal_url', 'noc_contact', 'admin_contact', 'circuit_count', + 'comments', 'tags', ) default_columns = ('pk', 'name', 'asn', 'account', 'circuit_count') @@ -56,6 +60,10 @@ class Meta(BaseTable.Meta): class ProviderNetworkTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -69,7 +77,7 @@ class ProviderNetworkTable(BaseTable): class Meta(BaseTable.Meta): model = ProviderNetwork - fields = ('pk', 'name', 'provider', 'description', 'comments', 'tags') + fields = ('pk', 'id', 'name', 'provider', 'description', 'comments', 'tags') default_columns = ('pk', 'name', 'provider', 'description') @@ -79,6 +87,10 @@ class Meta(BaseTable.Meta): class CircuitTypeTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -89,7 +101,7 @@ class CircuitTypeTable(BaseTable): class Meta(BaseTable.Meta): model = CircuitType - fields = ('pk', 'name', 'circuit_count', 'description', 'slug', 'actions') + fields = ('pk', 'id', 'name', 'circuit_count', 'description', 'slug', 'actions') default_columns = ('pk', 'name', 'circuit_count', 'description', 'slug', 'actions') diff --git a/netbox/dcim/tables/power.py b/netbox/dcim/tables/power.py index b8e032e7ff0..40d128b5827 100644 --- a/netbox/dcim/tables/power.py +++ b/netbox/dcim/tables/power.py @@ -16,6 +16,10 @@ class PowerPanelTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -33,7 +37,7 @@ class PowerPanelTable(BaseTable): class Meta(BaseTable.Meta): model = PowerPanel - fields = ('pk', 'name', 'site', 'location', 'powerfeed_count', 'tags') + fields = ('pk', 'id', 'name', 'site', 'location', 'powerfeed_count', 'tags') default_columns = ('pk', 'name', 'site', 'location', 'powerfeed_count') @@ -45,6 +49,10 @@ class Meta(BaseTable.Meta): # cannot traverse pass-through ports. class PowerFeedTable(CableTerminationTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -70,7 +78,7 @@ class PowerFeedTable(CableTerminationTable): class Meta(BaseTable.Meta): model = PowerFeed fields = ( - 'pk', 'name', 'power_panel', 'rack', 'status', 'type', 'supply', 'voltage', 'amperage', 'phase', + 'pk', 'id', 'name', 'power_panel', 'rack', 'status', 'type', 'supply', 'voltage', 'amperage', 'phase', 'max_utilization', 'mark_connected', 'cable', 'cable_color', 'cable_peer', 'connection', 'available_power', 'comments', 'tags', ) From fa5633601074cfa4659a466eafef0a0b36c0eaca Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:39:32 -0400 Subject: [PATCH 04/14] netbox-community/netbox#6930: Add ID column to virtualization tables --- netbox/virtualization/tables.py | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/netbox/virtualization/tables.py b/netbox/virtualization/tables.py index b0e922e71b8..0e90024209b 100644 --- a/netbox/virtualization/tables.py +++ b/netbox/virtualization/tables.py @@ -34,6 +34,10 @@ class ClusterTypeTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -44,7 +48,7 @@ class ClusterTypeTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterType - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -54,6 +58,10 @@ class Meta(BaseTable.Meta): class ClusterGroupTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -64,7 +72,7 @@ class ClusterGroupTable(BaseTable): class Meta(BaseTable.Meta): model = ClusterGroup - fields = ('pk', 'name', 'slug', 'cluster_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'cluster_count', 'description', 'actions') default_columns = ('pk', 'name', 'cluster_count', 'description', 'actions') @@ -74,6 +82,10 @@ class Meta(BaseTable.Meta): class ClusterTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -100,7 +112,7 @@ class ClusterTable(BaseTable): class Meta(BaseTable.Meta): model = Cluster - fields = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'tags') + fields = ('pk', 'id', 'name', 'type', 'group', 'tenant', 'site', 'comments', 'device_count', 'vm_count', 'tags') default_columns = ('pk', 'name', 'type', 'group', 'tenant', 'site', 'device_count', 'vm_count') @@ -110,6 +122,10 @@ class Meta(BaseTable.Meta): class VirtualMachineTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -140,7 +156,7 @@ class VirtualMachineTable(BaseTable): class Meta(BaseTable.Meta): model = VirtualMachine fields = ( - 'pk', 'name', 'status', 'cluster', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'primary_ip4', + 'pk', 'id', 'name', 'status', 'cluster', 'role', 'tenant', 'platform', 'vcpus', 'memory', 'disk', 'primary_ip4', 'primary_ip6', 'primary_ip', 'comments', 'tags', ) default_columns = ( @@ -154,6 +170,10 @@ class Meta(BaseTable.Meta): class VMInterfaceTable(BaseInterfaceTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) virtual_machine = tables.Column( linkify=True ) @@ -170,7 +190,7 @@ class VMInterfaceTable(BaseInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'virtual_machine', 'enabled', 'parent', 'mac_address', 'mtu', 'mode', 'description', 'tags', + 'pk', 'id', 'name', 'virtual_machine', 'enabled', 'parent', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', ) default_columns = ('pk', 'name', 'virtual_machine', 'enabled', 'parent', 'description') @@ -186,7 +206,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable): class Meta(BaseTable.Meta): model = VMInterface fields = ( - 'pk', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', + 'pk', 'id', 'name', 'enabled', 'mac_address', 'mtu', 'mode', 'description', 'tags', 'ip_addresses', 'untagged_vlan', 'tagged_vlans', 'actions', ) default_columns = ( From b75a872ddadf457007fdb219532c332742ae552c Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:46:01 -0400 Subject: [PATCH 05/14] netbox-community/netbox#6930: Add ID column to IPAM tables --- netbox/ipam/tables/ip.py | 36 ++++++++++++++++++++++++++++------ netbox/ipam/tables/services.py | 6 +++++- netbox/ipam/tables/vlans.py | 12 ++++++++++-- netbox/ipam/tables/vrfs.py | 12 ++++++++++-- 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index ddad6c57340..03f56fd8158 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -74,6 +74,10 @@ class RIRTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -89,7 +93,7 @@ class RIRTable(BaseTable): class Meta(BaseTable.Meta): model = RIR - fields = ('pk', 'name', 'slug', 'is_private', 'aggregate_count', 'description', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'is_private', 'aggregate_count', 'description', 'actions') default_columns = ('pk', 'name', 'is_private', 'aggregate_count', 'description', 'actions') @@ -99,6 +103,10 @@ class Meta(BaseTable.Meta): class AggregateTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) prefix = tables.Column( linkify=True, verbose_name='Aggregate' @@ -121,7 +129,7 @@ class AggregateTable(BaseTable): class Meta(BaseTable.Meta): model = Aggregate - fields = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags') + fields = ('pk', 'id', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags') default_columns = ('pk', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description') @@ -131,6 +139,10 @@ class Meta(BaseTable.Meta): class RoleTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -148,7 +160,7 @@ class RoleTable(BaseTable): class Meta(BaseTable.Meta): model = Role - fields = ('pk', 'name', 'slug', 'prefix_count', 'vlan_count', 'description', 'weight', 'actions') + fields = ('pk', 'id', 'name', 'slug', 'prefix_count', 'vlan_count', 'description', 'weight', 'actions') default_columns = ('pk', 'name', 'prefix_count', 'vlan_count', 'description', 'actions') @@ -173,6 +185,10 @@ class PrefixUtilizationColumn(UtilizationColumn): class PrefixTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) prefix = tables.TemplateColumn( template_code=PREFIX_LINK, attrs={'td': {'class': 'text-nowrap'}} @@ -230,7 +246,7 @@ class PrefixTable(BaseTable): class Meta(BaseTable.Meta): model = Prefix fields = ( - 'pk', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', + 'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site', 'vlan', 'role', 'is_pool', 'mark_utilized', 'description', 'tags', ) default_columns = ( @@ -246,6 +262,10 @@ class Meta(BaseTable.Meta): # class IPRangeTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) start_address = tables.Column( linkify=True ) @@ -268,7 +288,7 @@ class IPRangeTable(BaseTable): class Meta(BaseTable.Meta): model = IPRange fields = ( - 'pk', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'description', + 'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'description', 'utilization', ) default_columns = ( @@ -285,6 +305,10 @@ class Meta(BaseTable.Meta): class IPAddressTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) address = tables.TemplateColumn( template_code=IPADDRESS_LINK, verbose_name='IP Address' @@ -326,7 +350,7 @@ class IPAddressTable(BaseTable): class Meta(BaseTable.Meta): model = IPAddress fields = ( - 'pk', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description', + 'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description', 'tags', ) default_columns = ( diff --git a/netbox/ipam/tables/services.py b/netbox/ipam/tables/services.py index 58c8ea49e61..c254846fec6 100644 --- a/netbox/ipam/tables/services.py +++ b/netbox/ipam/tables/services.py @@ -14,6 +14,10 @@ class ServiceTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -31,5 +35,5 @@ class ServiceTable(BaseTable): class Meta(BaseTable.Meta): model = Service - fields = ('pk', 'name', 'parent', 'protocol', 'ports', 'ipaddresses', 'description', 'tags') + fields = ('pk', 'id', 'name', 'parent', 'protocol', 'ports', 'ipaddresses', 'description', 'tags') default_columns = ('pk', 'name', 'parent', 'protocol', 'ports', 'description') diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index fd1e92be8a0..09f283cc2d3 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -63,6 +63,10 @@ class VLANGroupTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column(linkify=True) scope_type = ContentTypeColumn() scope = tables.Column( @@ -81,7 +85,7 @@ class VLANGroupTable(BaseTable): class Meta(BaseTable.Meta): model = VLANGroup - fields = ('pk', 'name', 'scope_type', 'scope', 'vlan_count', 'slug', 'description', 'actions') + fields = ('pk', 'id', 'name', 'scope_type', 'scope', 'vlan_count', 'slug', 'description', 'actions') default_columns = ('pk', 'name', 'scope_type', 'scope', 'vlan_count', 'description', 'actions') @@ -91,6 +95,10 @@ class Meta(BaseTable.Meta): class VLANTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) vid = tables.TemplateColumn( template_code=VLAN_LINK, verbose_name='ID' @@ -119,7 +127,7 @@ class VLANTable(BaseTable): class Meta(BaseTable.Meta): model = VLAN - fields = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description', 'tags') + fields = ('pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description', 'tags') default_columns = ('pk', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description') row_attrs = { 'class': lambda record: 'success' if not isinstance(record, VLAN) else '', diff --git a/netbox/ipam/tables/vrfs.py b/netbox/ipam/tables/vrfs.py index 3a351a85616..2b3b24cafe5 100644 --- a/netbox/ipam/tables/vrfs.py +++ b/netbox/ipam/tables/vrfs.py @@ -22,6 +22,10 @@ class VRFTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -47,7 +51,7 @@ class VRFTable(BaseTable): class Meta(BaseTable.Meta): model = VRF fields = ( - 'pk', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets', 'export_targets', 'tags', + 'pk', 'id', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets', 'export_targets', 'tags', ) default_columns = ('pk', 'name', 'rd', 'tenant', 'description') @@ -58,6 +62,10 @@ class Meta(BaseTable.Meta): class RouteTargetTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -68,5 +76,5 @@ class RouteTargetTable(BaseTable): class Meta(BaseTable.Meta): model = RouteTarget - fields = ('pk', 'name', 'tenant', 'description', 'tags') + fields = ('pk', 'id', 'name', 'tenant', 'description', 'tags') default_columns = ('pk', 'name', 'tenant', 'description') From 61d20639db8db045551612b3598097f8229cdecf Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Thu, 28 Oct 2021 12:56:53 -0400 Subject: [PATCH 06/14] netbox-community/netbox#6930: Add ID column to 'extras' tables --- netbox/extras/tables.py | 60 ++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 10 deletions(-) diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index 20a6ffd8acd..5bce11a3cf8 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -48,6 +48,10 @@ class CustomFieldTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -57,8 +61,8 @@ class CustomFieldTable(BaseTable): class Meta(BaseTable.Meta): model = CustomField fields = ( - 'pk', 'name', 'content_types', 'label', 'type', 'required', 'weight', 'default', 'description', - 'filter_logic', 'choices', + 'pk', 'id', 'name', 'content_types', 'label', 'type', 'required', 'weight', 'default', + 'description', 'filter_logic', 'choices', ) default_columns = ('pk', 'name', 'content_types', 'label', 'type', 'required', 'description') @@ -69,6 +73,10 @@ class Meta(BaseTable.Meta): class CustomLinkTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -78,7 +86,8 @@ class CustomLinkTable(BaseTable): class Meta(BaseTable.Meta): model = CustomLink fields = ( - 'pk', 'name', 'content_type', 'link_text', 'link_url', 'weight', 'group_name', 'button_class', 'new_window', + 'pk', 'id', 'name', 'content_type', 'link_text', 'link_url', 'weight', 'group_name', + 'button_class', 'new_window', ) default_columns = ('pk', 'name', 'content_type', 'group_name', 'button_class', 'new_window') @@ -89,6 +98,10 @@ class Meta(BaseTable.Meta): class ExportTemplateTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -98,7 +111,7 @@ class ExportTemplateTable(BaseTable): class Meta(BaseTable.Meta): model = ExportTemplate fields = ( - 'pk', 'name', 'content_type', 'description', 'mime_type', 'file_extension', 'as_attachment', + 'pk', 'id', 'name', 'content_type', 'description', 'mime_type', 'file_extension', 'as_attachment', ) default_columns = ( 'pk', 'name', 'content_type', 'description', 'mime_type', 'file_extension', 'as_attachment', @@ -111,6 +124,10 @@ class Meta(BaseTable.Meta): class WebhookTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -132,7 +149,7 @@ class WebhookTable(BaseTable): class Meta(BaseTable.Meta): model = Webhook fields = ( - 'pk', 'name', 'content_types', 'enabled', 'type_create', 'type_update', 'type_delete', 'http_method', + 'pk', 'id', 'name', 'content_types', 'enabled', 'type_create', 'type_update', 'type_delete', 'http_method', 'payload_url', 'secret', 'ssl_validation', 'ca_file_path', ) default_columns = ( @@ -147,6 +164,10 @@ class Meta(BaseTable.Meta): class TagTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -155,7 +176,8 @@ class TagTable(BaseTable): class Meta(BaseTable.Meta): model = Tag - fields = ('pk', 'name', 'items', 'slug', 'color', 'description', 'actions') + fields = ('pk', 'id', 'name', 'items', 'slug', 'color', 'description', 'actions') + default_columns = ('pk', 'name', 'items', 'slug', 'color', 'description', 'actions') class TaggedItemTable(BaseTable): @@ -175,6 +197,10 @@ class Meta(BaseTable.Meta): class ConfigContextTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) name = tables.Column( linkify=True ) @@ -185,13 +211,17 @@ class ConfigContextTable(BaseTable): class Meta(BaseTable.Meta): model = ConfigContext fields = ( - 'pk', 'name', 'weight', 'is_active', 'description', 'regions', 'sites', 'roles', 'platforms', - 'cluster_groups', 'clusters', 'tenant_groups', 'tenants', + 'pk', 'id', 'name', 'weight', 'is_active', 'description', 'regions', 'sites', 'roles', + 'platforms', 'cluster_groups', 'clusters', 'tenant_groups', 'tenants', ) default_columns = ('pk', 'name', 'weight', 'is_active', 'description') class ObjectChangeTable(BaseTable): + id = tables.Column( + linkify=True, + verbose_name="ID" + ) time = tables.DateTimeColumn( linkify=True, format=settings.SHORT_DATETIME_FORMAT @@ -211,7 +241,8 @@ class ObjectChangeTable(BaseTable): class Meta(BaseTable.Meta): model = ObjectChange - fields = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id') + fields = ('id', 'time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id') + default_columns = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id') class ObjectJournalTable(BaseTable): @@ -237,6 +268,10 @@ class Meta(BaseTable.Meta): class JournalEntryTable(ObjectJournalTable): pk = ToggleColumn() + id = tables.Column( + linkify=True, + verbose_name="ID" + ) assigned_object_type = ContentTypeColumn( verbose_name='Object type' ) @@ -250,5 +285,10 @@ class JournalEntryTable(ObjectJournalTable): class Meta(BaseTable.Meta): model = JournalEntry fields = ( - 'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', 'comments', 'actions' + 'pk', 'id', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', + 'comments', 'actions' + ) + default_columns = ( + 'pk', 'created', 'created_by', 'assigned_object_type', 'assigned_object', 'kind', + 'comments', 'actions' ) From 02f2cf49e267e6a917a7bd03d3cac5eb1a6bddba Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 11:20:17 -0400 Subject: [PATCH 07/14] netbox-community/netbox#6930: Move ID column to BaseTable class --- netbox/circuits/tables.py | 12 ------------ netbox/dcim/tables/cables.py | 4 ---- netbox/dcim/tables/devices.py | 20 ------------------- netbox/dcim/tables/devicetypes.py | 8 -------- netbox/dcim/tables/power.py | 8 -------- netbox/dcim/tables/racks.py | 12 ------------ netbox/dcim/tables/sites.py | 16 ---------------- netbox/extras/tables.py | 32 ------------------------------- netbox/ipam/tables/ip.py | 24 ----------------------- netbox/ipam/tables/services.py | 4 ---- netbox/ipam/tables/vlans.py | 8 -------- netbox/ipam/tables/vrfs.py | 8 -------- netbox/tenancy/tables.py | 8 -------- netbox/utilities/tables.py | 5 +++++ netbox/virtualization/tables.py | 20 ------------------- 15 files changed, 5 insertions(+), 184 deletions(-) diff --git a/netbox/circuits/tables.py b/netbox/circuits/tables.py index 708deddc2e1..bbababb9bcb 100644 --- a/netbox/circuits/tables.py +++ b/netbox/circuits/tables.py @@ -29,10 +29,6 @@ class ProviderTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -60,10 +56,6 @@ class Meta(BaseTable.Meta): class ProviderNetworkTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -87,10 +79,6 @@ class Meta(BaseTable.Meta): class CircuitTypeTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) diff --git a/netbox/dcim/tables/cables.py b/netbox/dcim/tables/cables.py index 14cf3450514..5533c45280c 100644 --- a/netbox/dcim/tables/cables.py +++ b/netbox/dcim/tables/cables.py @@ -16,10 +16,6 @@ class CableTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) termination_a_parent = tables.TemplateColumn( template_code=CABLE_TERMINATION_PARENT, accessor=Accessor('termination_a'), diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index 86d88650b20..fd3a45fc3a7 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -69,10 +69,6 @@ def get_interface_state_attribute(record): class DeviceRoleTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) name = tables.Column( linkify=True ) @@ -102,10 +98,6 @@ class Meta(BaseTable.Meta): class PlatformTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) name = tables.Column( linkify=True ) @@ -138,10 +130,6 @@ class Meta(BaseTable.Meta): class DeviceTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.TemplateColumn( order_by=('_name',), template_code=DEVICE_LINK @@ -249,10 +237,6 @@ class Meta(BaseTable.Meta): class DeviceComponentTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) device = tables.Column( linkify=True ) @@ -762,10 +746,6 @@ class Meta(BaseTable.Meta): class VirtualChassisTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) name = tables.Column( linkify=True ) diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index 7f1f27e584d..5939f8d1ab4 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -28,10 +28,6 @@ class ManufacturerTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) name = tables.Column( linkify=True ) @@ -63,10 +59,6 @@ class Meta(BaseTable.Meta): class DeviceTypeTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name='ID' - ) model = tables.Column( linkify=True, verbose_name='Device Type' diff --git a/netbox/dcim/tables/power.py b/netbox/dcim/tables/power.py index 40d128b5827..955b27941c0 100644 --- a/netbox/dcim/tables/power.py +++ b/netbox/dcim/tables/power.py @@ -16,10 +16,6 @@ class PowerPanelTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -49,10 +45,6 @@ class Meta(BaseTable.Meta): # cannot traverse pass-through ports. class PowerFeedTable(CableTerminationTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index 9fbda9bbd00..f3d1cb7f84a 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -21,10 +21,6 @@ class RackRoleTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column(linkify=True) rack_count = tables.Column(verbose_name='Racks') color = ColorColumn() @@ -42,10 +38,6 @@ class Meta(BaseTable.Meta): class RackTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( order_by=('_name',), linkify=True @@ -99,10 +91,6 @@ class Meta(BaseTable.Meta): class RackReservationTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) reservation = tables.Column( accessor='pk', linkify=True diff --git a/netbox/dcim/tables/sites.py b/netbox/dcim/tables/sites.py index 03d3347d137..56180236dd5 100644 --- a/netbox/dcim/tables/sites.py +++ b/netbox/dcim/tables/sites.py @@ -21,10 +21,6 @@ class RegionTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = MPTTColumn( linkify=True ) @@ -47,10 +43,6 @@ class Meta(BaseTable.Meta): class SiteGroupTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = MPTTColumn( linkify=True ) @@ -73,10 +65,6 @@ class Meta(BaseTable.Meta): class SiteTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -109,10 +97,6 @@ class Meta(BaseTable.Meta): class LocationTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = MPTTColumn( linkify=True ) diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index 5bce11a3cf8..3edf88e9889 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -48,10 +48,6 @@ class CustomFieldTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -73,10 +69,6 @@ class Meta(BaseTable.Meta): class CustomLinkTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -98,10 +90,6 @@ class Meta(BaseTable.Meta): class ExportTemplateTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -124,10 +112,6 @@ class Meta(BaseTable.Meta): class WebhookTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -164,10 +148,6 @@ class Meta(BaseTable.Meta): class TagTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -197,10 +177,6 @@ class Meta(BaseTable.Meta): class ConfigContextTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -218,10 +194,6 @@ class Meta(BaseTable.Meta): class ObjectChangeTable(BaseTable): - id = tables.Column( - linkify=True, - verbose_name="ID" - ) time = tables.DateTimeColumn( linkify=True, format=settings.SHORT_DATETIME_FORMAT @@ -268,10 +240,6 @@ class Meta(BaseTable.Meta): class JournalEntryTable(ObjectJournalTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) assigned_object_type = ContentTypeColumn( verbose_name='Object type' ) diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index 03f56fd8158..dac2f1e5e02 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -74,10 +74,6 @@ class RIRTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -103,10 +99,6 @@ class Meta(BaseTable.Meta): class AggregateTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) prefix = tables.Column( linkify=True, verbose_name='Aggregate' @@ -139,10 +131,6 @@ class Meta(BaseTable.Meta): class RoleTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -185,10 +173,6 @@ class PrefixUtilizationColumn(UtilizationColumn): class PrefixTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) prefix = tables.TemplateColumn( template_code=PREFIX_LINK, attrs={'td': {'class': 'text-nowrap'}} @@ -262,10 +246,6 @@ class Meta(BaseTable.Meta): # class IPRangeTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) start_address = tables.Column( linkify=True ) @@ -305,10 +285,6 @@ class Meta(BaseTable.Meta): class IPAddressTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) address = tables.TemplateColumn( template_code=IPADDRESS_LINK, verbose_name='IP Address' diff --git a/netbox/ipam/tables/services.py b/netbox/ipam/tables/services.py index c254846fec6..ff6b766f7a9 100644 --- a/netbox/ipam/tables/services.py +++ b/netbox/ipam/tables/services.py @@ -14,10 +14,6 @@ class ServiceTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index 09f283cc2d3..cf326d14880 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -63,10 +63,6 @@ class VLANGroupTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column(linkify=True) scope_type = ContentTypeColumn() scope = tables.Column( @@ -95,10 +91,6 @@ class Meta(BaseTable.Meta): class VLANTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) vid = tables.TemplateColumn( template_code=VLAN_LINK, verbose_name='ID' diff --git a/netbox/ipam/tables/vrfs.py b/netbox/ipam/tables/vrfs.py index 2b3b24cafe5..1264368f464 100644 --- a/netbox/ipam/tables/vrfs.py +++ b/netbox/ipam/tables/vrfs.py @@ -22,10 +22,6 @@ class VRFTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -62,10 +58,6 @@ class Meta(BaseTable.Meta): class RouteTargetTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) diff --git a/netbox/tenancy/tables.py b/netbox/tenancy/tables.py index 3190a65ed42..a7bb087d85a 100644 --- a/netbox/tenancy/tables.py +++ b/netbox/tenancy/tables.py @@ -43,10 +43,6 @@ def value(self, value): class TenantGroupTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = MPTTColumn( linkify=True ) @@ -69,10 +65,6 @@ class Meta(BaseTable.Meta): class TenantTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) diff --git a/netbox/utilities/tables.py b/netbox/utilities/tables.py index 42c9ffb5670..8258bd5e8e8 100644 --- a/netbox/utilities/tables.py +++ b/netbox/utilities/tables.py @@ -133,6 +133,11 @@ def objects_count(self): self._objects_count = sum(1 for obj in self.data if hasattr(obj, 'pk')) return self._objects_count + id = tables.Column( + linkify=True, + verbose_name='ID' + ) + # # Table columns diff --git a/netbox/virtualization/tables.py b/netbox/virtualization/tables.py index 0e90024209b..cb6e6404380 100644 --- a/netbox/virtualization/tables.py +++ b/netbox/virtualization/tables.py @@ -34,10 +34,6 @@ class ClusterTypeTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -58,10 +54,6 @@ class Meta(BaseTable.Meta): class ClusterGroupTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -82,10 +74,6 @@ class Meta(BaseTable.Meta): class ClusterTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -122,10 +110,6 @@ class Meta(BaseTable.Meta): class VirtualMachineTable(BaseTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) name = tables.Column( linkify=True ) @@ -170,10 +154,6 @@ class Meta(BaseTable.Meta): class VMInterfaceTable(BaseInterfaceTable): pk = ToggleColumn() - id = tables.Column( - linkify=True, - verbose_name="ID" - ) virtual_machine = tables.Column( linkify=True ) From 8aef9f3a48fdce44085d844482d9a5cf224cdd8b Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 12:25:23 -0400 Subject: [PATCH 08/14] netbox-community/netbox#6930: Don't linkify ID in device component template tables --- netbox/dcim/tables/devicetypes.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index 5939f8d1ab4..d400156e43d 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -93,6 +93,9 @@ class Meta(BaseTable.Meta): class ComponentTemplateTable(BaseTable): pk = ToggleColumn() + id = tables.Column( + verbose_name='ID' + ) name = tables.Column( order_by=('_name',) ) From 7b97b14bf06044d439171ef5a3b77f03032bdca8 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 12:42:33 -0400 Subject: [PATCH 09/14] netbox-community/netbox#6930: Don't show ID column in interface/console/power connections tables --- netbox/dcim/tables/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netbox/dcim/tables/__init__.py b/netbox/dcim/tables/__init__.py index 8a861c8c20f..825e60d57b0 100644 --- a/netbox/dcim/tables/__init__.py +++ b/netbox/dcim/tables/__init__.py @@ -43,6 +43,7 @@ class ConsoleConnectionTable(BaseTable): class Meta(BaseTable.Meta): model = ConsolePort fields = ('device', 'name', 'console_server', 'console_server_port', 'reachable') + exclude = ('id', ) class PowerConnectionTable(BaseTable): @@ -73,6 +74,7 @@ class PowerConnectionTable(BaseTable): class Meta(BaseTable.Meta): model = PowerPort fields = ('device', 'name', 'pdu', 'outlet', 'reachable') + exclude = ('id', ) class InterfaceConnectionTable(BaseTable): @@ -106,3 +108,4 @@ class InterfaceConnectionTable(BaseTable): class Meta(BaseTable.Meta): model = Interface fields = ('device_a', 'interface_a', 'device_b', 'interface_b', 'reachable') + exclude = ('id', ) From fdc9f1f99af7d643ef805f23c56e6887163579ec Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 13:24:22 -0400 Subject: [PATCH 10/14] netbox-community/netbox#6930: Don't show ID column in device component template tables --- netbox/dcim/tables/devicetypes.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/netbox/dcim/tables/devicetypes.py b/netbox/dcim/tables/devicetypes.py index d400156e43d..d176d3ff662 100644 --- a/netbox/dcim/tables/devicetypes.py +++ b/netbox/dcim/tables/devicetypes.py @@ -100,6 +100,9 @@ class ComponentTemplateTable(BaseTable): order_by=('_name',) ) + class Meta(BaseTable.Meta): + exclude = ('id', ) + class ConsolePortTemplateTable(ComponentTemplateTable): actions = ButtonsColumn( @@ -108,7 +111,7 @@ class ConsolePortTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_consoleports' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = ConsolePortTemplate fields = ('pk', 'name', 'label', 'type', 'description', 'actions') empty_text = "None" @@ -121,7 +124,7 @@ class ConsoleServerPortTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_consoleserverports' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = ConsoleServerPortTemplate fields = ('pk', 'name', 'label', 'type', 'description', 'actions') empty_text = "None" @@ -134,7 +137,7 @@ class PowerPortTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_powerports' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = PowerPortTemplate fields = ('pk', 'name', 'label', 'type', 'maximum_draw', 'allocated_draw', 'description', 'actions') empty_text = "None" @@ -147,7 +150,7 @@ class PowerOutletTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_poweroutlets' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = PowerOutletTemplate fields = ('pk', 'name', 'label', 'type', 'power_port', 'feed_leg', 'description', 'actions') empty_text = "None" @@ -163,7 +166,7 @@ class InterfaceTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_interfaces' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = InterfaceTemplate fields = ('pk', 'name', 'label', 'mgmt_only', 'type', 'description', 'actions') empty_text = "None" @@ -180,7 +183,7 @@ class FrontPortTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_frontports' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = FrontPortTemplate fields = ('pk', 'name', 'label', 'type', 'color', 'rear_port', 'rear_port_position', 'description', 'actions') empty_text = "None" @@ -194,7 +197,7 @@ class RearPortTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_rearports' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = RearPortTemplate fields = ('pk', 'name', 'label', 'type', 'color', 'positions', 'description', 'actions') empty_text = "None" @@ -207,7 +210,7 @@ class DeviceBayTemplateTable(ComponentTemplateTable): return_url_extra='%23tab_devicebays' ) - class Meta(BaseTable.Meta): + class Meta(ComponentTemplateTable.Meta): model = DeviceBayTemplate fields = ('pk', 'name', 'label', 'description', 'actions') empty_text = "None" From 6d478d1c9b3e69fea6a2fb6c6d71fca6da6d7fe8 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 13:28:48 -0400 Subject: [PATCH 11/14] netbox-community/netbox#6930: Add ID column to ObjectJournal, DeviceImport, and Circuit tables --- netbox/circuits/tables.py | 2 +- netbox/dcim/tables/devices.py | 2 +- netbox/extras/tables.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netbox/circuits/tables.py b/netbox/circuits/tables.py index bbababb9bcb..847d44ffd5b 100644 --- a/netbox/circuits/tables.py +++ b/netbox/circuits/tables.py @@ -124,7 +124,7 @@ class CircuitTable(BaseTable): class Meta(BaseTable.Meta): model = Circuit fields = ( - 'pk', 'cid', 'provider', 'type', 'status', 'tenant', 'termination_a', 'termination_z', 'install_date', + 'pk', 'id', 'cid', 'provider', 'type', 'status', 'tenant', 'termination_a', 'termination_z', 'install_date', 'commit_rate', 'description', 'comments', 'tags', ) default_columns = ( diff --git a/netbox/dcim/tables/devices.py b/netbox/dcim/tables/devices.py index fd3a45fc3a7..675f7d7776d 100644 --- a/netbox/dcim/tables/devices.py +++ b/netbox/dcim/tables/devices.py @@ -227,7 +227,7 @@ class DeviceImportTable(BaseTable): class Meta(BaseTable.Meta): model = Device - fields = ('name', 'status', 'tenant', 'site', 'rack', 'position', 'device_role', 'device_type') + fields = ('id', 'name', 'status', 'tenant', 'site', 'rack', 'position', 'device_role', 'device_type') empty_text = False diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index 3edf88e9889..ba6133cdca0 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -235,7 +235,7 @@ class ObjectJournalTable(BaseTable): class Meta(BaseTable.Meta): model = JournalEntry - fields = ('created', 'created_by', 'kind', 'comments', 'actions') + fields = ('id', 'created', 'created_by', 'kind', 'comments', 'actions') class JournalEntryTable(ObjectJournalTable): From cc2501eedd0645f106a3f08c5a5bb21dbff9a3c1 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 13:30:06 -0400 Subject: [PATCH 12/14] Exclude ID column from selected tables --- netbox/extras/tables.py | 1 + netbox/ipam/tables/ip.py | 2 ++ netbox/ipam/tables/vlans.py | 3 +++ 3 files changed, 6 insertions(+) diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index ba6133cdca0..31b943c2761 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -173,6 +173,7 @@ class TaggedItemTable(BaseTable): class Meta(BaseTable.Meta): model = TaggedItem fields = ('content_type', 'content_object') + exclude = ('id', ) class ConfigContextTable(BaseTable): diff --git a/netbox/ipam/tables/ip.py b/netbox/ipam/tables/ip.py index dac2f1e5e02..84ce7dd8a12 100644 --- a/netbox/ipam/tables/ip.py +++ b/netbox/ipam/tables/ip.py @@ -350,6 +350,7 @@ class IPAddressAssignTable(BaseTable): class Meta(BaseTable.Meta): model = IPAddress fields = ('address', 'dns_name', 'vrf', 'status', 'role', 'tenant', 'assigned_object', 'description') + exclude = ('id', ) orderable = False @@ -374,3 +375,4 @@ class InterfaceIPAddressTable(BaseTable): class Meta(BaseTable.Meta): model = IPAddress fields = ('address', 'vrf', 'status', 'role', 'tenant', 'description') + exclude = ('id', ) diff --git a/netbox/ipam/tables/vlans.py b/netbox/ipam/tables/vlans.py index cf326d14880..84b250f872c 100644 --- a/netbox/ipam/tables/vlans.py +++ b/netbox/ipam/tables/vlans.py @@ -149,6 +149,7 @@ class VLANDevicesTable(VLANMembersTable): class Meta(BaseTable.Meta): model = Interface fields = ('device', 'name', 'tagged', 'actions') + exclude = ('id', ) class VLANVirtualMachinesTable(VLANMembersTable): @@ -160,6 +161,7 @@ class VLANVirtualMachinesTable(VLANMembersTable): class Meta(BaseTable.Meta): model = VMInterface fields = ('virtual_machine', 'name', 'tagged', 'actions') + exclude = ('id', ) class InterfaceVLANTable(BaseTable): @@ -187,6 +189,7 @@ class InterfaceVLANTable(BaseTable): class Meta(BaseTable.Meta): model = VLAN fields = ('vid', 'tagged', 'site', 'group', 'name', 'tenant', 'status', 'role', 'description') + exclude = ('id', ) def __init__(self, interface, *args, **kwargs): self.interface = interface From 3b36dd2c81a72ca07bf933bf622fa5adaa5b2c48 Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Fri, 29 Oct 2021 13:36:40 -0400 Subject: [PATCH 13/14] netbox-community/netbox#6930:revert default columns on ObjectChangeTable, not configurable --- netbox/extras/tables.py | 1 - 1 file changed, 1 deletion(-) diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index 31b943c2761..63b3748c8aa 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -215,7 +215,6 @@ class ObjectChangeTable(BaseTable): class Meta(BaseTable.Meta): model = ObjectChange fields = ('id', 'time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id') - default_columns = ('time', 'user_name', 'action', 'changed_object_type', 'object_repr', 'request_id') class ObjectJournalTable(BaseTable): From ceae4ed75b2e55fa34e0fb85b57d9d6dff7796df Mon Sep 17 00:00:00 2001 From: Rhys Barrie Date: Mon, 1 Nov 2021 11:56:31 -0400 Subject: [PATCH 14/14] netbox-community/netbox#6930: Add object ID to tagged objects table in tag detail view --- netbox/extras/tables.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/netbox/extras/tables.py b/netbox/extras/tables.py index 63b3748c8aa..266f2089a40 100644 --- a/netbox/extras/tables.py +++ b/netbox/extras/tables.py @@ -161,6 +161,11 @@ class Meta(BaseTable.Meta): class TaggedItemTable(BaseTable): + id = tables.Column( + verbose_name='ID', + linkify=lambda record: record.content_object.get_absolute_url(), + accessor='content_object__id' + ) content_type = ContentTypeColumn( verbose_name='Type' ) @@ -172,8 +177,7 @@ class TaggedItemTable(BaseTable): class Meta(BaseTable.Meta): model = TaggedItem - fields = ('content_type', 'content_object') - exclude = ('id', ) + fields = ('id', 'content_type', 'content_object') class ConfigContextTable(BaseTable):