netbox-community/netbox#6930: Move ID column to BaseTable class

This commit is contained in:
Rhys Barrie 2021-10-29 11:20:17 -04:00
parent 61d20639db
commit 02f2cf49e2
15 changed files with 5 additions and 184 deletions

View File

@ -29,10 +29,6 @@ CIRCUITTERMINATION_LINK = """
class ProviderTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -60,10 +56,6 @@ class ProviderTable(BaseTable):
class ProviderNetworkTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -87,10 +79,6 @@ class ProviderNetworkTable(BaseTable):
class CircuitTypeTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)

View File

@ -16,10 +16,6 @@ __all__ = (
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'),

View File

@ -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 DeviceRoleTable(BaseTable):
class PlatformTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name='ID'
)
name = tables.Column(
linkify=True
)
@ -138,10 +130,6 @@ class PlatformTable(BaseTable):
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 DeviceImportTable(BaseTable):
class DeviceComponentTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name='ID'
)
device = tables.Column(
linkify=True
)
@ -762,10 +746,6 @@ class DeviceInventoryItemTable(InventoryItemTable):
class VirtualChassisTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name='ID'
)
name = tables.Column(
linkify=True
)

View File

@ -28,10 +28,6 @@ __all__ = (
class ManufacturerTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name='ID'
)
name = tables.Column(
linkify=True
)
@ -63,10 +59,6 @@ class ManufacturerTable(BaseTable):
class DeviceTypeTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name='ID'
)
model = tables.Column(
linkify=True,
verbose_name='Device Type'

View File

@ -16,10 +16,6 @@ __all__ = (
class PowerPanelTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -49,10 +45,6 @@ class PowerPanelTable(BaseTable):
# cannot traverse pass-through ports.
class PowerFeedTable(CableTerminationTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)

View File

@ -21,10 +21,6 @@ __all__ = (
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 RackRoleTable(BaseTable):
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 RackTable(BaseTable):
class RackReservationTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
reservation = tables.Column(
accessor='pk',
linkify=True

View File

@ -21,10 +21,6 @@ __all__ = (
class RegionTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = MPTTColumn(
linkify=True
)
@ -47,10 +43,6 @@ class RegionTable(BaseTable):
class SiteGroupTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = MPTTColumn(
linkify=True
)
@ -73,10 +65,6 @@ class SiteGroupTable(BaseTable):
class SiteTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -109,10 +97,6 @@ class SiteTable(BaseTable):
class LocationTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = MPTTColumn(
linkify=True
)

View File

@ -48,10 +48,6 @@ OBJECTCHANGE_REQUEST_ID = """
class CustomFieldTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -73,10 +69,6 @@ class CustomFieldTable(BaseTable):
class CustomLinkTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -98,10 +90,6 @@ class CustomLinkTable(BaseTable):
class ExportTemplateTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -124,10 +112,6 @@ class ExportTemplateTable(BaseTable):
class WebhookTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -164,10 +148,6 @@ class WebhookTable(BaseTable):
class TagTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -197,10 +177,6 @@ class TaggedItemTable(BaseTable):
class ConfigContextTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -218,10 +194,6 @@ class ConfigContextTable(BaseTable):
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 ObjectJournalTable(BaseTable):
class JournalEntryTable(ObjectJournalTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
assigned_object_type = ContentTypeColumn(
verbose_name='Object type'
)

View File

@ -74,10 +74,6 @@ VRF_LINK = """
class RIRTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -103,10 +99,6 @@ class RIRTable(BaseTable):
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 AggregateTable(BaseTable):
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 PrefixTable(BaseTable):
#
class IPRangeTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
start_address = tables.Column(
linkify=True
)
@ -305,10 +285,6 @@ class IPRangeTable(BaseTable):
class IPAddressTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
address = tables.TemplateColumn(
template_code=IPADDRESS_LINK,
verbose_name='IP Address'

View File

@ -14,10 +14,6 @@ __all__ = (
class ServiceTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)

View File

@ -63,10 +63,6 @@ VLAN_MEMBER_TAGGED = """
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 VLANGroupTable(BaseTable):
class VLANTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
vid = tables.TemplateColumn(
template_code=VLAN_LINK,
verbose_name='ID'

View File

@ -22,10 +22,6 @@ VRF_TARGETS = """
class VRFTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -62,10 +58,6 @@ class VRFTable(BaseTable):
class RouteTargetTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)

View File

@ -43,10 +43,6 @@ class TenantColumn(tables.TemplateColumn):
class TenantGroupTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = MPTTColumn(
linkify=True
)
@ -69,10 +65,6 @@ class TenantGroupTable(BaseTable):
class TenantTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)

View File

@ -133,6 +133,11 @@ class BaseTable(tables.Table):
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

View File

@ -34,10 +34,6 @@ VMINTERFACE_BUTTONS = """
class ClusterTypeTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -58,10 +54,6 @@ class ClusterTypeTable(BaseTable):
class ClusterGroupTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -82,10 +74,6 @@ class ClusterGroupTable(BaseTable):
class ClusterTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -122,10 +110,6 @@ class ClusterTable(BaseTable):
class VirtualMachineTable(BaseTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
name = tables.Column(
linkify=True
)
@ -170,10 +154,6 @@ class VirtualMachineTable(BaseTable):
class VMInterfaceTable(BaseInterfaceTable):
pk = ToggleColumn()
id = tables.Column(
linkify=True,
verbose_name="ID"
)
virtual_machine = tables.Column(
linkify=True
)