Преглед на файлове

Closes #8469: Move BaseTable, columns to netbox core app

jeremystretch преди 4 години
родител
ревизия
4a1b4e0485

+ 15 - 16
netbox/circuits/tables.py

@@ -1,11 +1,10 @@
 import django_tables2 as tables
 import django_tables2 as tables
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import BaseTable, ChoiceFieldColumn, MarkdownColumn, TagColumn, ToggleColumn
 from .models import *
 from .models import *
 
 
-
 __all__ = (
 __all__ = (
     'CircuitTable',
     'CircuitTable',
     'CircuitTypeTable',
     'CircuitTypeTable',
@@ -22,11 +21,11 @@ CIRCUITTERMINATION_LINK = """
 {% endif %}
 {% endif %}
 """
 """
 
 
+
 #
 #
 # Table columns
 # Table columns
 #
 #
 
 
-
 class CommitRateColumn(tables.TemplateColumn):
 class CommitRateColumn(tables.TemplateColumn):
     """
     """
     Humanize the commit rate in the column view
     Humanize the commit rate in the column view
@@ -43,13 +42,13 @@ class CommitRateColumn(tables.TemplateColumn):
     def value(self, value):
     def value(self, value):
         return str(value) if value else None
         return str(value) if value else None
 
 
+
 #
 #
 # Providers
 # Providers
 #
 #
 
 
-
 class ProviderTable(BaseTable):
 class ProviderTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -57,8 +56,8 @@ class ProviderTable(BaseTable):
         accessor=Accessor('count_circuits'),
         accessor=Accessor('count_circuits'),
         verbose_name='Circuits'
         verbose_name='Circuits'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='circuits:provider_list'
         url_name='circuits:provider_list'
     )
     )
 
 
@@ -76,15 +75,15 @@ class ProviderTable(BaseTable):
 #
 #
 
 
 class ProviderNetworkTable(BaseTable):
 class ProviderNetworkTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     provider = tables.Column(
     provider = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='circuits:providernetwork_list'
         url_name='circuits:providernetwork_list'
     )
     )
 
 
@@ -101,11 +100,11 @@ class ProviderNetworkTable(BaseTable):
 #
 #
 
 
 class CircuitTypeTable(BaseTable):
 class CircuitTypeTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='circuits:circuittype_list'
         url_name='circuits:circuittype_list'
     )
     )
     circuit_count = tables.Column(
     circuit_count = tables.Column(
@@ -125,7 +124,7 @@ class CircuitTypeTable(BaseTable):
 #
 #
 
 
 class CircuitTable(BaseTable):
 class CircuitTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     cid = tables.Column(
     cid = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='Circuit ID'
         verbose_name='Circuit ID'
@@ -133,7 +132,7 @@ class CircuitTable(BaseTable):
     provider = tables.Column(
     provider = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
     termination_a = tables.TemplateColumn(
     termination_a = tables.TemplateColumn(
         template_code=CIRCUITTERMINATION_LINK,
         template_code=CIRCUITTERMINATION_LINK,
@@ -144,8 +143,8 @@ class CircuitTable(BaseTable):
         verbose_name='Side Z'
         verbose_name='Side Z'
     )
     )
     commit_rate = CommitRateColumn()
     commit_rate = CommitRateColumn()
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='circuits:circuit_list'
         url_name='circuits:circuit_list'
     )
     )
 
 

+ 1 - 2
netbox/circuits/views.py

@@ -5,10 +5,9 @@ from django.shortcuts import get_object_or_404, redirect, render
 
 
 from netbox.views import generic
 from netbox.views import generic
 from utilities.forms import ConfirmationForm
 from utilities.forms import ConfirmationForm
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from . import filtersets, forms, tables
 from . import filtersets, forms, tables
-from .choices import CircuitTerminationSideChoices
 from .models import *
 from .models import *
 
 
 
 

+ 4 - 4
netbox/dcim/tables/__init__.py

@@ -1,8 +1,8 @@
 import django_tables2 as tables
 import django_tables2 as tables
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
-from utilities.tables import BaseTable, BooleanColumn
 from dcim.models import ConsolePort, Interface, PowerPort
 from dcim.models import ConsolePort, Interface, PowerPort
+from netbox.tables import BaseTable, columns
 from .cables import *
 from .cables import *
 from .devices import *
 from .devices import *
 from .devicetypes import *
 from .devicetypes import *
@@ -36,7 +36,7 @@ class ConsoleConnectionTable(BaseTable):
         linkify=True,
         linkify=True,
         verbose_name='Console Port'
         verbose_name='Console Port'
     )
     )
-    reachable = BooleanColumn(
+    reachable = columns.BooleanColumn(
         accessor=Accessor('_path__is_active'),
         accessor=Accessor('_path__is_active'),
         verbose_name='Reachable'
         verbose_name='Reachable'
     )
     )
@@ -67,7 +67,7 @@ class PowerConnectionTable(BaseTable):
         linkify=True,
         linkify=True,
         verbose_name='Power Port'
         verbose_name='Power Port'
     )
     )
-    reachable = BooleanColumn(
+    reachable = columns.BooleanColumn(
         accessor=Accessor('_path__is_active'),
         accessor=Accessor('_path__is_active'),
         verbose_name='Reachable'
         verbose_name='Reachable'
     )
     )
@@ -101,7 +101,7 @@ class InterfaceConnectionTable(BaseTable):
         linkify=True,
         linkify=True,
         verbose_name='Interface B'
         verbose_name='Interface B'
     )
     )
-    reachable = BooleanColumn(
+    reachable = columns.BooleanColumn(
         accessor=Accessor('_path__is_active'),
         accessor=Accessor('_path__is_active'),
         verbose_name='Reachable'
         verbose_name='Reachable'
     )
     )

+ 6 - 6
netbox/dcim/tables/cables.py

@@ -2,8 +2,8 @@ import django_tables2 as tables
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
 from dcim.models import Cable
 from dcim.models import Cable
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import BaseTable, ChoiceFieldColumn, ColorColumn, TagColumn, TemplateColumn, ToggleColumn
 from .template_code import CABLE_LENGTH, CABLE_TERMINATION_PARENT
 from .template_code import CABLE_LENGTH, CABLE_TERMINATION_PARENT
 
 
 __all__ = (
 __all__ = (
@@ -16,7 +16,7 @@ __all__ = (
 #
 #
 
 
 class CableTable(BaseTable):
 class CableTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     termination_a_parent = tables.TemplateColumn(
     termination_a_parent = tables.TemplateColumn(
         template_code=CABLE_TERMINATION_PARENT,
         template_code=CABLE_TERMINATION_PARENT,
         accessor=Accessor('termination_a'),
         accessor=Accessor('termination_a'),
@@ -41,14 +41,14 @@ class CableTable(BaseTable):
         linkify=True,
         linkify=True,
         verbose_name='Termination B'
         verbose_name='Termination B'
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
-    length = TemplateColumn(
+    length = columns.TemplateColumn(
         template_code=CABLE_LENGTH,
         template_code=CABLE_LENGTH,
         order_by='_abs_length'
         order_by='_abs_length'
     )
     )
-    color = ColorColumn()
-    tags = TagColumn(
+    color = columns.ColorColumn()
+    tags = columns.TagColumn(
         url_name='dcim:cable_list'
         url_name='dcim:cable_list'
     )
     )
 
 

+ 56 - 59
netbox/dcim/tables/devices.py

@@ -5,11 +5,8 @@ from dcim.models import (
     ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem,
     ConsolePort, ConsoleServerPort, Device, DeviceBay, DeviceRole, FrontPort, Interface, InventoryItem,
     InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
     InventoryItemRole, ModuleBay, Platform, PowerOutlet, PowerPort, RearPort, VirtualChassis,
 )
 )
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    ActionsColumn, BaseTable, BooleanColumn, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn,
-    MarkdownColumn, TagColumn, TemplateColumn, ToggleColumn,
-)
 from .template_code import *
 from .template_code import *
 
 
 __all__ = (
 __all__ = (
@@ -75,23 +72,23 @@ def get_interface_state_attribute(record):
 #
 #
 
 
 class DeviceRoleTable(BaseTable):
 class DeviceRoleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    device_count = LinkedCountColumn(
+    device_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='Devices'
         verbose_name='Devices'
     )
     )
-    vm_count = LinkedCountColumn(
+    vm_count = columns.LinkedCountColumn(
         viewname='virtualization:virtualmachine_list',
         viewname='virtualization:virtualmachine_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='VMs'
         verbose_name='VMs'
     )
     )
-    color = ColorColumn()
-    vm_role = BooleanColumn()
-    tags = TagColumn(
+    color = columns.ColorColumn()
+    vm_role = columns.BooleanColumn()
+    tags = columns.TagColumn(
         url_name='dcim:devicerole_list'
         url_name='dcim:devicerole_list'
     )
     )
 
 
@@ -109,21 +106,21 @@ class DeviceRoleTable(BaseTable):
 #
 #
 
 
 class PlatformTable(BaseTable):
 class PlatformTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    device_count = LinkedCountColumn(
+    device_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'platform_id': 'pk'},
         url_params={'platform_id': 'pk'},
         verbose_name='Devices'
         verbose_name='Devices'
     )
     )
-    vm_count = LinkedCountColumn(
+    vm_count = columns.LinkedCountColumn(
         viewname='virtualization:virtualmachine_list',
         viewname='virtualization:virtualmachine_list',
         url_params={'platform_id': 'pk'},
         url_params={'platform_id': 'pk'},
         verbose_name='VMs'
         verbose_name='VMs'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:platform_list'
         url_name='dcim:platform_list'
     )
     )
 
 
@@ -143,12 +140,12 @@ class PlatformTable(BaseTable):
 #
 #
 
 
 class DeviceTable(BaseTable):
 class DeviceTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.TemplateColumn(
     name = tables.TemplateColumn(
         order_by=('_name',),
         order_by=('_name',),
         template_code=DEVICE_LINK
         template_code=DEVICE_LINK
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
@@ -159,7 +156,7 @@ class DeviceTable(BaseTable):
     rack = tables.Column(
     rack = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    device_role = ColoredLabelColumn(
+    device_role = columns.ColoredLabelColumn(
         verbose_name='Role'
         verbose_name='Role'
     )
     )
     manufacturer = tables.Column(
     manufacturer = tables.Column(
@@ -195,8 +192,8 @@ class DeviceTable(BaseTable):
     vc_priority = tables.Column(
     vc_priority = tables.Column(
         verbose_name='VC Priority'
         verbose_name='VC Priority'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:device_list'
         url_name='dcim:device_list'
     )
     )
 
 
@@ -218,7 +215,7 @@ class DeviceImportTable(BaseTable):
     name = tables.TemplateColumn(
     name = tables.TemplateColumn(
         template_code=DEVICE_LINK
         template_code=DEVICE_LINK
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
@@ -244,7 +241,7 @@ class DeviceImportTable(BaseTable):
 #
 #
 
 
 class DeviceComponentTable(BaseTable):
 class DeviceComponentTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     device = tables.Column(
     device = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -274,22 +271,22 @@ class CableTerminationTable(BaseTable):
     cable = tables.Column(
     cable = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    cable_color = ColorColumn(
+    cable_color = columns.ColorColumn(
         accessor='cable.color',
         accessor='cable.color',
         orderable=False,
         orderable=False,
         verbose_name='Cable Color'
         verbose_name='Cable Color'
     )
     )
-    link_peer = TemplateColumn(
+    link_peer = columns.TemplateColumn(
         accessor='_link_peer',
         accessor='_link_peer',
         template_code=LINKTERMINATION,
         template_code=LINKTERMINATION,
         orderable=False,
         orderable=False,
         verbose_name='Link Peer'
         verbose_name='Link Peer'
     )
     )
-    mark_connected = BooleanColumn()
+    mark_connected = columns.BooleanColumn()
 
 
 
 
 class PathEndpointTable(CableTerminationTable):
 class PathEndpointTable(CableTerminationTable):
-    connection = TemplateColumn(
+    connection = columns.TemplateColumn(
         accessor='_path.last_node',
         accessor='_path.last_node',
         template_code=LINKTERMINATION,
         template_code=LINKTERMINATION,
         verbose_name='Connection',
         verbose_name='Connection',
@@ -304,7 +301,7 @@ class ConsolePortTable(ModularDeviceComponentTable, PathEndpointTable):
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:consoleport_list'
         url_name='dcim:consoleport_list'
     )
     )
 
 
@@ -323,7 +320,7 @@ class DeviceConsolePortTable(ConsolePortTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=CONSOLEPORT_BUTTONS
         extra_buttons=CONSOLEPORT_BUTTONS
     )
     )
 
 
@@ -346,7 +343,7 @@ class ConsoleServerPortTable(ModularDeviceComponentTable, PathEndpointTable):
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:consoleserverport_list'
         url_name='dcim:consoleserverport_list'
     )
     )
 
 
@@ -366,7 +363,7 @@ class DeviceConsoleServerPortTable(ConsoleServerPortTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=CONSOLESERVERPORT_BUTTONS
         extra_buttons=CONSOLESERVERPORT_BUTTONS
     )
     )
 
 
@@ -389,7 +386,7 @@ class PowerPortTable(ModularDeviceComponentTable, PathEndpointTable):
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:powerport_list'
         url_name='dcim:powerport_list'
     )
     )
 
 
@@ -410,7 +407,7 @@ class DevicePowerPortTable(PowerPortTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=POWERPORT_BUTTONS
         extra_buttons=POWERPORT_BUTTONS
     )
     )
 
 
@@ -438,7 +435,7 @@ class PowerOutletTable(ModularDeviceComponentTable, PathEndpointTable):
     power_port = tables.Column(
     power_port = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:poweroutlet_list'
         url_name='dcim:poweroutlet_list'
     )
     )
 
 
@@ -458,7 +455,7 @@ class DevicePowerOutletTable(PowerOutletTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=POWEROUTLET_BUTTONS
         extra_buttons=POWEROUTLET_BUTTONS
     )
     )
 
 
@@ -477,7 +474,7 @@ class DevicePowerOutletTable(PowerOutletTable):
 
 
 
 
 class BaseInterfaceTable(BaseTable):
 class BaseInterfaceTable(BaseTable):
-    enabled = BooleanColumn()
+    enabled = columns.BooleanColumn()
     ip_addresses = tables.TemplateColumn(
     ip_addresses = tables.TemplateColumn(
         template_code=INTERFACE_IPADDRESSES,
         template_code=INTERFACE_IPADDRESSES,
         orderable=False,
         orderable=False,
@@ -490,7 +487,7 @@ class BaseInterfaceTable(BaseTable):
         verbose_name='FHRP Groups'
         verbose_name='FHRP Groups'
     )
     )
     untagged_vlan = tables.Column(linkify=True)
     untagged_vlan = tables.Column(linkify=True)
-    tagged_vlans = TemplateColumn(
+    tagged_vlans = columns.TemplateColumn(
         template_code=INTERFACE_TAGGED_VLANS,
         template_code=INTERFACE_TAGGED_VLANS,
         orderable=False,
         orderable=False,
         verbose_name='Tagged VLANs'
         verbose_name='Tagged VLANs'
@@ -504,11 +501,11 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    mgmt_only = BooleanColumn()
+    mgmt_only = columns.BooleanColumn()
     wireless_link = tables.Column(
     wireless_link = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    wireless_lans = TemplateColumn(
+    wireless_lans = columns.TemplateColumn(
         template_code=INTERFACE_WIRELESS_LANS,
         template_code=INTERFACE_WIRELESS_LANS,
         orderable=False,
         orderable=False,
         verbose_name='Wireless LANs'
         verbose_name='Wireless LANs'
@@ -516,7 +513,7 @@ class InterfaceTable(ModularDeviceComponentTable, BaseInterfaceTable, PathEndpoi
     vrf = tables.Column(
     vrf = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:interface_list'
         url_name='dcim:interface_list'
     )
     )
 
 
@@ -550,7 +547,7 @@ class DeviceInterfaceTable(InterfaceTable):
         linkify=True,
         linkify=True,
         verbose_name='LAG'
         verbose_name='LAG'
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=INTERFACE_BUTTONS
         extra_buttons=INTERFACE_BUTTONS
     )
     )
 
 
@@ -582,14 +579,14 @@ class FrontPortTable(ModularDeviceComponentTable, CableTerminationTable):
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    color = ColorColumn()
+    color = columns.ColorColumn()
     rear_port_position = tables.Column(
     rear_port_position = tables.Column(
         verbose_name='Position'
         verbose_name='Position'
     )
     )
     rear_port = tables.Column(
     rear_port = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:frontport_list'
         url_name='dcim:frontport_list'
     )
     )
 
 
@@ -612,7 +609,7 @@ class DeviceFrontPortTable(FrontPortTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=FRONTPORT_BUTTONS
         extra_buttons=FRONTPORT_BUTTONS
     )
     )
 
 
@@ -637,8 +634,8 @@ class RearPortTable(ModularDeviceComponentTable, CableTerminationTable):
             'args': [Accessor('device_id')],
             'args': [Accessor('device_id')],
         }
         }
     )
     )
-    color = ColorColumn()
-    tags = TagColumn(
+    color = columns.ColorColumn()
+    tags = columns.TagColumn(
         url_name='dcim:rearport_list'
         url_name='dcim:rearport_list'
     )
     )
 
 
@@ -658,7 +655,7 @@ class DeviceRearPortTable(RearPortTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=REARPORT_BUTTONS
         extra_buttons=REARPORT_BUTTONS
     )
     )
 
 
@@ -690,7 +687,7 @@ class DeviceBayTable(DeviceComponentTable):
     installed_device = tables.Column(
     installed_device = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:devicebay_list'
         url_name='dcim:devicebay_list'
     )
     )
 
 
@@ -711,7 +708,7 @@ class DeviceDeviceBayTable(DeviceBayTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=DEVICEBAY_BUTTONS
         extra_buttons=DEVICEBAY_BUTTONS
     )
     )
 
 
@@ -734,7 +731,7 @@ class ModuleBayTable(DeviceComponentTable):
         linkify=True,
         linkify=True,
         verbose_name='Installed module'
         verbose_name='Installed module'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:modulebay_list'
         url_name='dcim:modulebay_list'
     )
     )
 
 
@@ -745,7 +742,7 @@ class ModuleBayTable(DeviceComponentTable):
 
 
 
 
 class DeviceModuleBayTable(ModuleBayTable):
 class DeviceModuleBayTable(ModuleBayTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=MODULEBAY_BUTTONS
         extra_buttons=MODULEBAY_BUTTONS
     )
     )
 
 
@@ -773,8 +770,8 @@ class InventoryItemTable(DeviceComponentTable):
         orderable=False,
         orderable=False,
         linkify=True
         linkify=True
     )
     )
-    discovered = BooleanColumn()
-    tags = TagColumn(
+    discovered = columns.BooleanColumn()
+    tags = columns.TagColumn(
         url_name='dcim:inventoryitem_list'
         url_name='dcim:inventoryitem_list'
     )
     )
     cable = None  # Override DeviceComponentTable
     cable = None  # Override DeviceComponentTable
@@ -797,7 +794,7 @@ class DeviceInventoryItemTable(InventoryItemTable):
         order_by=Accessor('_name'),
         order_by=Accessor('_name'),
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
     )
     )
-    actions = ActionsColumn()
+    actions = columns.ActionsColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = InventoryItem
         model = InventoryItem
@@ -811,17 +808,17 @@ class DeviceInventoryItemTable(InventoryItemTable):
 
 
 
 
 class InventoryItemRoleTable(BaseTable):
 class InventoryItemRoleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    inventoryitem_count = LinkedCountColumn(
+    inventoryitem_count = columns.LinkedCountColumn(
         viewname='dcim:inventoryitem_list',
         viewname='dcim:inventoryitem_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='Items'
         verbose_name='Items'
     )
     )
-    color = ColorColumn()
-    tags = TagColumn(
+    color = columns.ColorColumn()
+    tags = columns.TagColumn(
         url_name='dcim:inventoryitemrole_list'
         url_name='dcim:inventoryitemrole_list'
     )
     )
 
 
@@ -838,19 +835,19 @@ class InventoryItemRoleTable(BaseTable):
 #
 #
 
 
 class VirtualChassisTable(BaseTable):
 class VirtualChassisTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     master = tables.Column(
     master = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    member_count = LinkedCountColumn(
+    member_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'virtual_chassis_id': 'pk'},
         url_params={'virtual_chassis_id': 'pk'},
         verbose_name='Members'
         verbose_name='Members'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:virtualchassis_list'
         url_name='dcim:virtualchassis_list'
     )
     )
 
 

+ 22 - 24
netbox/dcim/tables/devicetypes.py

@@ -5,9 +5,7 @@ from dcim.models import (
     ConsolePortTemplate, ConsoleServerPortTemplate, DeviceBayTemplate, DeviceType, FrontPortTemplate, InterfaceTemplate,
     ConsolePortTemplate, ConsoleServerPortTemplate, DeviceBayTemplate, DeviceType, FrontPortTemplate, InterfaceTemplate,
     InventoryItemTemplate, Manufacturer, ModuleBayTemplate, PowerOutletTemplate, PowerPortTemplate, RearPortTemplate,
     InventoryItemTemplate, Manufacturer, ModuleBayTemplate, PowerOutletTemplate, PowerPortTemplate, RearPortTemplate,
 )
 )
-from utilities.tables import (
-    ActionsColumn, BaseTable, BooleanColumn, ColorColumn, LinkedCountColumn, MarkdownColumn, TagColumn, ToggleColumn,
-)
+from netbox.tables import BaseTable, columns
 from .template_code import MODULAR_COMPONENT_TEMPLATE_BUTTONS
 from .template_code import MODULAR_COMPONENT_TEMPLATE_BUTTONS
 
 
 __all__ = (
 __all__ = (
@@ -31,7 +29,7 @@ __all__ = (
 #
 #
 
 
 class ManufacturerTable(BaseTable):
 class ManufacturerTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -45,7 +43,7 @@ class ManufacturerTable(BaseTable):
         verbose_name='Platforms'
         verbose_name='Platforms'
     )
     )
     slug = tables.Column()
     slug = tables.Column()
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:manufacturer_list'
         url_name='dcim:manufacturer_list'
     )
     )
 
 
@@ -65,21 +63,21 @@ class ManufacturerTable(BaseTable):
 #
 #
 
 
 class DeviceTypeTable(BaseTable):
 class DeviceTypeTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     model = tables.Column(
     model = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='Device Type'
         verbose_name='Device Type'
     )
     )
-    is_full_depth = BooleanColumn(
+    is_full_depth = columns.BooleanColumn(
         verbose_name='Full Depth'
         verbose_name='Full Depth'
     )
     )
-    instance_count = LinkedCountColumn(
+    instance_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'device_type_id': 'pk'},
         url_params={'device_type_id': 'pk'},
         verbose_name='Instances'
         verbose_name='Instances'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:devicetype_list'
         url_name='dcim:devicetype_list'
     )
     )
 
 
@@ -99,7 +97,7 @@ class DeviceTypeTable(BaseTable):
 #
 #
 
 
 class ComponentTemplateTable(BaseTable):
 class ComponentTemplateTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     id = tables.Column(
     id = tables.Column(
         verbose_name='ID'
         verbose_name='ID'
     )
     )
@@ -112,7 +110,7 @@ class ComponentTemplateTable(BaseTable):
 
 
 
 
 class ConsolePortTemplateTable(ComponentTemplateTable):
 class ConsolePortTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -124,7 +122,7 @@ class ConsolePortTemplateTable(ComponentTemplateTable):
 
 
 
 
 class ConsoleServerPortTemplateTable(ComponentTemplateTable):
 class ConsoleServerPortTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -136,7 +134,7 @@ class ConsoleServerPortTemplateTable(ComponentTemplateTable):
 
 
 
 
 class PowerPortTemplateTable(ComponentTemplateTable):
 class PowerPortTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -148,7 +146,7 @@ class PowerPortTemplateTable(ComponentTemplateTable):
 
 
 
 
 class PowerOutletTemplateTable(ComponentTemplateTable):
 class PowerOutletTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -160,10 +158,10 @@ class PowerOutletTemplateTable(ComponentTemplateTable):
 
 
 
 
 class InterfaceTemplateTable(ComponentTemplateTable):
 class InterfaceTemplateTable(ComponentTemplateTable):
-    mgmt_only = BooleanColumn(
+    mgmt_only = columns.BooleanColumn(
         verbose_name='Management Only'
         verbose_name='Management Only'
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -178,8 +176,8 @@ class FrontPortTemplateTable(ComponentTemplateTable):
     rear_port_position = tables.Column(
     rear_port_position = tables.Column(
         verbose_name='Position'
         verbose_name='Position'
     )
     )
-    color = ColorColumn()
-    actions = ActionsColumn(
+    color = columns.ColorColumn()
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -191,8 +189,8 @@ class FrontPortTemplateTable(ComponentTemplateTable):
 
 
 
 
 class RearPortTemplateTable(ComponentTemplateTable):
 class RearPortTemplateTable(ComponentTemplateTable):
-    color = ColorColumn()
-    actions = ActionsColumn(
+    color = columns.ColorColumn()
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
         extra_buttons=MODULAR_COMPONENT_TEMPLATE_BUTTONS
     )
     )
@@ -204,7 +202,7 @@ class RearPortTemplateTable(ComponentTemplateTable):
 
 
 
 
 class ModuleBayTemplateTable(ComponentTemplateTable):
 class ModuleBayTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete')
         sequence=('edit', 'delete')
     )
     )
 
 
@@ -215,7 +213,7 @@ class ModuleBayTemplateTable(ComponentTemplateTable):
 
 
 
 
 class DeviceBayTemplateTable(ComponentTemplateTable):
 class DeviceBayTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete')
         sequence=('edit', 'delete')
     )
     )
 
 
@@ -226,7 +224,7 @@ class DeviceBayTemplateTable(ComponentTemplateTable):
 
 
 
 
 class InventoryItemTemplateTable(ComponentTemplateTable):
 class InventoryItemTemplateTable(ComponentTemplateTable):
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete')
         sequence=('edit', 'delete')
     )
     )
     role = tables.Column(
     role = tables.Column(

+ 8 - 8
netbox/dcim/tables/modules.py

@@ -1,7 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
 from dcim.models import Module, ModuleType
 from dcim.models import Module, ModuleType
-from utilities.tables import BaseTable, LinkedCountColumn, MarkdownColumn, TagColumn, ToggleColumn
+from netbox.tables import BaseTable, columns
 
 
 __all__ = (
 __all__ = (
     'ModuleTable',
     'ModuleTable',
@@ -10,18 +10,18 @@ __all__ = (
 
 
 
 
 class ModuleTypeTable(BaseTable):
 class ModuleTypeTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     model = tables.Column(
     model = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='Module Type'
         verbose_name='Module Type'
     )
     )
-    instance_count = LinkedCountColumn(
+    instance_count = columns.LinkedCountColumn(
         viewname='dcim:module_list',
         viewname='dcim:module_list',
         url_params={'module_type_id': 'pk'},
         url_params={'module_type_id': 'pk'},
         verbose_name='Instances'
         verbose_name='Instances'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:moduletype_list'
         url_name='dcim:moduletype_list'
     )
     )
 
 
@@ -36,7 +36,7 @@ class ModuleTypeTable(BaseTable):
 
 
 
 
 class ModuleTable(BaseTable):
 class ModuleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     device = tables.Column(
     device = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -46,8 +46,8 @@ class ModuleTable(BaseTable):
     module_type = tables.Column(
     module_type = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:module_list'
         url_name='dcim:module_list'
     )
     )
 
 

+ 9 - 9
netbox/dcim/tables/power.py

@@ -1,7 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
 from dcim.models import PowerFeed, PowerPanel
 from dcim.models import PowerFeed, PowerPanel
-from utilities.tables import BaseTable, ChoiceFieldColumn, LinkedCountColumn, MarkdownColumn, TagColumn, ToggleColumn
+from netbox.tables import BaseTable, columns
 from .devices import CableTerminationTable
 from .devices import CableTerminationTable
 
 
 __all__ = (
 __all__ = (
@@ -15,19 +15,19 @@ __all__ = (
 #
 #
 
 
 class PowerPanelTable(BaseTable):
 class PowerPanelTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    powerfeed_count = LinkedCountColumn(
+    powerfeed_count = columns.LinkedCountColumn(
         viewname='dcim:powerfeed_list',
         viewname='dcim:powerfeed_list',
         url_params={'power_panel_id': 'pk'},
         url_params={'power_panel_id': 'pk'},
         verbose_name='Feeds'
         verbose_name='Feeds'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:powerpanel_list'
         url_name='dcim:powerpanel_list'
     )
     )
 
 
@@ -44,7 +44,7 @@ class PowerPanelTable(BaseTable):
 # We're not using PathEndpointTable for PowerFeed because power connections
 # We're not using PathEndpointTable for PowerFeed because power connections
 # cannot traverse pass-through ports.
 # cannot traverse pass-through ports.
 class PowerFeedTable(CableTerminationTable):
 class PowerFeedTable(CableTerminationTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -54,16 +54,16 @@ class PowerFeedTable(CableTerminationTable):
     rack = tables.Column(
     rack = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    status = ChoiceFieldColumn()
-    type = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
+    type = columns.ChoiceFieldColumn()
     max_utilization = tables.TemplateColumn(
     max_utilization = tables.TemplateColumn(
         template_code="{{ value }}%"
         template_code="{{ value }}%"
     )
     )
     available_power = tables.Column(
     available_power = tables.Column(
         verbose_name='Available power (VA)'
         verbose_name='Available power (VA)'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:powerfeed_list'
         url_name='dcim:powerfeed_list'
     )
     )
 
 

+ 14 - 17
netbox/dcim/tables/racks.py

@@ -2,11 +2,8 @@ import django_tables2 as tables
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
 from dcim.models import Rack, RackReservation, RackRole
 from dcim.models import Rack, RackReservation, RackRole
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    BaseTable, ChoiceFieldColumn, ColorColumn, ColoredLabelColumn, LinkedCountColumn, MarkdownColumn, TagColumn,
-    ToggleColumn, UtilizationColumn,
-)
 
 
 __all__ = (
 __all__ = (
     'RackTable',
     'RackTable',
@@ -20,11 +17,11 @@ __all__ = (
 #
 #
 
 
 class RackRoleTable(BaseTable):
 class RackRoleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(linkify=True)
     name = tables.Column(linkify=True)
     rack_count = tables.Column(verbose_name='Racks')
     rack_count = tables.Column(verbose_name='Racks')
-    color = ColorColumn()
-    tags = TagColumn(
+    color = columns.ColorColumn()
+    tags = columns.TagColumn(
         url_name='dcim:rackrole_list'
         url_name='dcim:rackrole_list'
     )
     )
 
 
@@ -42,7 +39,7 @@ class RackRoleTable(BaseTable):
 #
 #
 
 
 class RackTable(BaseTable):
 class RackTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         order_by=('_name',),
         order_by=('_name',),
         linkify=True
         linkify=True
@@ -54,27 +51,27 @@ class RackTable(BaseTable):
         linkify=True
         linkify=True
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    status = ChoiceFieldColumn()
-    role = ColoredLabelColumn()
+    status = columns.ChoiceFieldColumn()
+    role = columns.ColoredLabelColumn()
     u_height = tables.TemplateColumn(
     u_height = tables.TemplateColumn(
         template_code="{{ record.u_height }}U",
         template_code="{{ record.u_height }}U",
         verbose_name='Height'
         verbose_name='Height'
     )
     )
-    comments = MarkdownColumn()
-    device_count = LinkedCountColumn(
+    comments = columns.MarkdownColumn()
+    device_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'rack_id': 'pk'},
         url_params={'rack_id': 'pk'},
         verbose_name='Devices'
         verbose_name='Devices'
     )
     )
-    get_utilization = UtilizationColumn(
+    get_utilization = columns.UtilizationColumn(
         orderable=False,
         orderable=False,
         verbose_name='Space'
         verbose_name='Space'
     )
     )
-    get_power_utilization = UtilizationColumn(
+    get_power_utilization = columns.UtilizationColumn(
         orderable=False,
         orderable=False,
         verbose_name='Power'
         verbose_name='Power'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:rack_list'
         url_name='dcim:rack_list'
     )
     )
     outer_width = tables.TemplateColumn(
     outer_width = tables.TemplateColumn(
@@ -104,7 +101,7 @@ class RackTable(BaseTable):
 #
 #
 
 
 class RackReservationTable(BaseTable):
 class RackReservationTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     reservation = tables.Column(
     reservation = tables.Column(
         accessor='pk',
         accessor='pk',
         linkify=True
         linkify=True
@@ -121,7 +118,7 @@ class RackReservationTable(BaseTable):
         orderable=False,
         orderable=False,
         verbose_name='Units'
         verbose_name='Units'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:rackreservation_list'
         url_name='dcim:rackreservation_list'
     )
     )
 
 

+ 20 - 22
netbox/dcim/tables/sites.py

@@ -1,10 +1,8 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
 from dcim.models import Location, Region, Site, SiteGroup
 from dcim.models import Location, Region, Site, SiteGroup
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    ActionsColumn, BaseTable, ChoiceFieldColumn, LinkedCountColumn, MarkdownColumn, MPTTColumn, TagColumn, ToggleColumn,
-)
 from .template_code import LOCATION_BUTTONS
 from .template_code import LOCATION_BUTTONS
 
 
 __all__ = (
 __all__ = (
@@ -20,16 +18,16 @@ __all__ = (
 #
 #
 
 
 class RegionTable(BaseTable):
 class RegionTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
-    site_count = LinkedCountColumn(
+    site_count = columns.LinkedCountColumn(
         viewname='dcim:site_list',
         viewname='dcim:site_list',
         url_params={'region_id': 'pk'},
         url_params={'region_id': 'pk'},
         verbose_name='Sites'
         verbose_name='Sites'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:region_list'
         url_name='dcim:region_list'
     )
     )
 
 
@@ -46,16 +44,16 @@ class RegionTable(BaseTable):
 #
 #
 
 
 class SiteGroupTable(BaseTable):
 class SiteGroupTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
-    site_count = LinkedCountColumn(
+    site_count = columns.LinkedCountColumn(
         viewname='dcim:site_list',
         viewname='dcim:site_list',
         url_params={'group_id': 'pk'},
         url_params={'group_id': 'pk'},
         verbose_name='Sites'
         verbose_name='Sites'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:sitegroup_list'
         url_name='dcim:sitegroup_list'
     )
     )
 
 
@@ -72,26 +70,26 @@ class SiteGroupTable(BaseTable):
 #
 #
 
 
 class SiteTable(BaseTable):
 class SiteTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     region = tables.Column(
     region = tables.Column(
         linkify=True
         linkify=True
     )
     )
     group = tables.Column(
     group = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    asn_count = LinkedCountColumn(
+    asn_count = columns.LinkedCountColumn(
         accessor=tables.A('asns.count'),
         accessor=tables.A('asns.count'),
         viewname='ipam:asn_list',
         viewname='ipam:asn_list',
         url_params={'site_id': 'pk'},
         url_params={'site_id': 'pk'},
         verbose_name='ASNs'
         verbose_name='ASNs'
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='dcim:site_list'
         url_name='dcim:site_list'
     )
     )
 
 
@@ -110,28 +108,28 @@ class SiteTable(BaseTable):
 #
 #
 
 
 class LocationTable(BaseTable):
 class LocationTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    rack_count = LinkedCountColumn(
+    rack_count = columns.LinkedCountColumn(
         viewname='dcim:rack_list',
         viewname='dcim:rack_list',
         url_params={'location_id': 'pk'},
         url_params={'location_id': 'pk'},
         verbose_name='Racks'
         verbose_name='Racks'
     )
     )
-    device_count = LinkedCountColumn(
+    device_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'location_id': 'pk'},
         url_params={'location_id': 'pk'},
         verbose_name='Devices'
         verbose_name='Devices'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='dcim:location_list'
         url_name='dcim:location_list'
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=LOCATION_BUTTONS
         extra_buttons=LOCATION_BUTTONS
     )
     )
 
 

+ 1 - 1
netbox/dcim/views.py

@@ -20,7 +20,7 @@ from netbox.views import generic
 from utilities.forms import ConfirmationForm
 from utilities.forms import ConfirmationForm
 from utilities.paginator import EnhancedPaginator, get_paginate_count
 from utilities.paginator import EnhancedPaginator, get_paginate_count
 from utilities.permissions import get_permission_for_model
 from utilities.permissions import get_permission_for_model
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from utilities.views import GetReturnURLMixin, ObjectPermissionRequiredMixin
 from utilities.views import GetReturnURLMixin, ObjectPermissionRequiredMixin
 from virtualization.models import VirtualMachine
 from virtualization.models import VirtualMachine

+ 30 - 33
netbox/extras/tables.py

@@ -1,10 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 from django.conf import settings
 from django.conf import settings
 
 
-from utilities.tables import (
-    ActionsColumn, BaseTable, BooleanColumn, ChoiceFieldColumn, ColorColumn, ContentTypeColumn, ContentTypesColumn,
-    MarkdownColumn, ToggleColumn,
-)
+from netbox.tables import BaseTable, columns
 from .models import *
 from .models import *
 
 
 __all__ = (
 __all__ = (
@@ -47,12 +44,12 @@ OBJECTCHANGE_REQUEST_ID = """
 #
 #
 
 
 class CustomFieldTable(BaseTable):
 class CustomFieldTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    content_types = ContentTypesColumn()
-    required = BooleanColumn()
+    content_types = columns.ContentTypesColumn()
+    required = columns.BooleanColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = CustomField
         model = CustomField
@@ -68,13 +65,13 @@ class CustomFieldTable(BaseTable):
 #
 #
 
 
 class CustomLinkTable(BaseTable):
 class CustomLinkTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    content_type = ContentTypeColumn()
-    enabled = BooleanColumn()
-    new_window = BooleanColumn()
+    content_type = columns.ContentTypeColumn()
+    enabled = columns.BooleanColumn()
+    new_window = columns.BooleanColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = CustomLink
         model = CustomLink
@@ -90,12 +87,12 @@ class CustomLinkTable(BaseTable):
 #
 #
 
 
 class ExportTemplateTable(BaseTable):
 class ExportTemplateTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    content_type = ContentTypeColumn()
-    as_attachment = BooleanColumn()
+    content_type = columns.ContentTypeColumn()
+    as_attachment = columns.BooleanColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = ExportTemplate
         model = ExportTemplate
@@ -113,22 +110,22 @@ class ExportTemplateTable(BaseTable):
 #
 #
 
 
 class WebhookTable(BaseTable):
 class WebhookTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    content_types = ContentTypesColumn()
-    enabled = BooleanColumn()
-    type_create = BooleanColumn(
+    content_types = columns.ContentTypesColumn()
+    enabled = columns.BooleanColumn()
+    type_create = columns.BooleanColumn(
         verbose_name='Create'
         verbose_name='Create'
     )
     )
-    type_update = BooleanColumn(
+    type_update = columns.BooleanColumn(
         verbose_name='Update'
         verbose_name='Update'
     )
     )
-    type_delete = BooleanColumn(
+    type_delete = columns.BooleanColumn(
         verbose_name='Delete'
         verbose_name='Delete'
     )
     )
-    ssl_validation = BooleanColumn(
+    ssl_validation = columns.BooleanColumn(
         verbose_name='SSL Validation'
         verbose_name='SSL Validation'
     )
     )
 
 
@@ -149,11 +146,11 @@ class WebhookTable(BaseTable):
 #
 #
 
 
 class TagTable(BaseTable):
 class TagTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    color = ColorColumn()
+    color = columns.ColorColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = Tag
         model = Tag
@@ -167,7 +164,7 @@ class TaggedItemTable(BaseTable):
         linkify=lambda record: record.content_object.get_absolute_url(),
         linkify=lambda record: record.content_object.get_absolute_url(),
         accessor='content_object__id'
         accessor='content_object__id'
     )
     )
-    content_type = ContentTypeColumn(
+    content_type = columns.ContentTypeColumn(
         verbose_name='Type'
         verbose_name='Type'
     )
     )
     content_object = tables.Column(
     content_object = tables.Column(
@@ -182,11 +179,11 @@ class TaggedItemTable(BaseTable):
 
 
 
 
 class ConfigContextTable(BaseTable):
 class ConfigContextTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    is_active = BooleanColumn(
+    is_active = columns.BooleanColumn(
         verbose_name='Active'
         verbose_name='Active'
     )
     )
 
 
@@ -205,8 +202,8 @@ class ObjectChangeTable(BaseTable):
         linkify=True,
         linkify=True,
         format=settings.SHORT_DATETIME_FORMAT
         format=settings.SHORT_DATETIME_FORMAT
     )
     )
-    action = ChoiceFieldColumn()
-    changed_object_type = ContentTypeColumn(
+    action = columns.ChoiceFieldColumn()
+    changed_object_type = columns.ContentTypeColumn(
         verbose_name='Type'
         verbose_name='Type'
     )
     )
     object_repr = tables.TemplateColumn(
     object_repr = tables.TemplateColumn(
@@ -217,7 +214,7 @@ class ObjectChangeTable(BaseTable):
         template_code=OBJECTCHANGE_REQUEST_ID,
         template_code=OBJECTCHANGE_REQUEST_ID,
         verbose_name='Request ID'
         verbose_name='Request ID'
     )
     )
-    actions = ActionsColumn(sequence=())
+    actions = columns.ActionsColumn(sequence=())
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = ObjectChange
         model = ObjectChange
@@ -232,7 +229,7 @@ class ObjectJournalTable(BaseTable):
         linkify=True,
         linkify=True,
         format=settings.SHORT_DATETIME_FORMAT
         format=settings.SHORT_DATETIME_FORMAT
     )
     )
-    kind = ChoiceFieldColumn()
+    kind = columns.ChoiceFieldColumn()
     comments = tables.TemplateColumn(
     comments = tables.TemplateColumn(
         template_code='{% load helpers %}{{ value|render_markdown|truncatewords_html:50 }}'
         template_code='{% load helpers %}{{ value|render_markdown|truncatewords_html:50 }}'
     )
     )
@@ -243,8 +240,8 @@ class ObjectJournalTable(BaseTable):
 
 
 
 
 class JournalEntryTable(ObjectJournalTable):
 class JournalEntryTable(ObjectJournalTable):
-    pk = ToggleColumn()
-    assigned_object_type = ContentTypeColumn(
+    pk = columns.ToggleColumn()
+    assigned_object_type = columns.ContentTypeColumn(
         verbose_name='Object type'
         verbose_name='Object type'
     )
     )
     assigned_object = tables.Column(
     assigned_object = tables.Column(
@@ -252,7 +249,7 @@ class JournalEntryTable(ObjectJournalTable):
         orderable=False,
         orderable=False,
         verbose_name='Object'
         verbose_name='Object'
     )
     )
-    comments = MarkdownColumn()
+    comments = columns.MarkdownColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = JournalEntry
         model = JournalEntry

+ 1 - 1
netbox/extras/views.py

@@ -11,7 +11,7 @@ from rq import Worker
 from netbox.views import generic
 from netbox.views import generic
 from utilities.forms import ConfirmationForm
 from utilities.forms import ConfirmationForm
 from utilities.htmx import is_htmx
 from utilities.htmx import is_htmx
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import copy_safe_request, count_related, normalize_querydict, shallow_compare_dict
 from utilities.utils import copy_safe_request, count_related, normalize_querydict, shallow_compare_dict
 from utilities.views import ContentTypePermissionRequiredMixin
 from utilities.views import ContentTypePermissionRequiredMixin
 from . import filtersets, forms, tables
 from . import filtersets, forms, tables

+ 6 - 6
netbox/ipam/tables/fhrp.py

@@ -1,7 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
-from utilities.tables import ActionsColumn, BaseTable, MarkdownColumn, TagColumn, ToggleColumn
 from ipam.models import *
 from ipam.models import *
+from netbox.tables import BaseTable, columns
 
 
 __all__ = (
 __all__ = (
     'FHRPGroupTable',
     'FHRPGroupTable',
@@ -17,11 +17,11 @@ IPADDRESSES = """
 
 
 
 
 class FHRPGroupTable(BaseTable):
 class FHRPGroupTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     group_id = tables.Column(
     group_id = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    comments = MarkdownColumn()
+    comments = columns.MarkdownColumn()
     ip_addresses = tables.TemplateColumn(
     ip_addresses = tables.TemplateColumn(
         template_code=IPADDRESSES,
         template_code=IPADDRESSES,
         orderable=False,
         orderable=False,
@@ -30,7 +30,7 @@ class FHRPGroupTable(BaseTable):
     interface_count = tables.Column(
     interface_count = tables.Column(
         verbose_name='Interfaces'
         verbose_name='Interfaces'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:fhrpgroup_list'
         url_name='ipam:fhrpgroup_list'
     )
     )
 
 
@@ -44,7 +44,7 @@ class FHRPGroupTable(BaseTable):
 
 
 
 
 class FHRPGroupAssignmentTable(BaseTable):
 class FHRPGroupAssignmentTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     interface_parent = tables.Column(
     interface_parent = tables.Column(
         accessor=tables.A('interface.parent_object'),
         accessor=tables.A('interface.parent_object'),
         linkify=True,
         linkify=True,
@@ -58,7 +58,7 @@ class FHRPGroupAssignmentTable(BaseTable):
     group = tables.Column(
     group = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete')
         sequence=('edit', 'delete')
     )
     )
 
 

+ 32 - 34
netbox/ipam/tables/ip.py

@@ -3,10 +3,8 @@ from django.utils.safestring import mark_safe
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
 from ipam.models import *
 from ipam.models import *
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    BaseTable, BooleanColumn, ChoiceFieldColumn, LinkedCountColumn, TagColumn, ToggleColumn, UtilizationColumn,
-)
 
 
 __all__ = (
 __all__ = (
     'AggregateTable',
     'AggregateTable',
@@ -73,19 +71,19 @@ VRF_LINK = """
 #
 #
 
 
 class RIRTable(BaseTable):
 class RIRTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    is_private = BooleanColumn(
+    is_private = columns.BooleanColumn(
         verbose_name='Private'
         verbose_name='Private'
     )
     )
-    aggregate_count = LinkedCountColumn(
+    aggregate_count = columns.LinkedCountColumn(
         viewname='ipam:aggregate_list',
         viewname='ipam:aggregate_list',
         url_params={'rir_id': 'pk'},
         url_params={'rir_id': 'pk'},
         verbose_name='Aggregates'
         verbose_name='Aggregates'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:rir_list'
         url_name='ipam:rir_list'
     )
     )
 
 
@@ -103,13 +101,13 @@ class RIRTable(BaseTable):
 #
 #
 
 
 class ASNTable(BaseTable):
 class ASNTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     asn = tables.Column(
     asn = tables.Column(
         accessor=tables.A('asn_asdot'),
         accessor=tables.A('asn_asdot'),
         linkify=True
         linkify=True
     )
     )
 
 
-    site_count = LinkedCountColumn(
+    site_count = columns.LinkedCountColumn(
         viewname='dcim:site_list',
         viewname='dcim:site_list',
         url_params={'asn_id': 'pk'},
         url_params={'asn_id': 'pk'},
         verbose_name='Sites'
         verbose_name='Sites'
@@ -126,7 +124,7 @@ class ASNTable(BaseTable):
 #
 #
 
 
 class AggregateTable(BaseTable):
 class AggregateTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     prefix = tables.Column(
     prefix = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='Aggregate'
         verbose_name='Aggregate'
@@ -139,11 +137,11 @@ class AggregateTable(BaseTable):
     child_count = tables.Column(
     child_count = tables.Column(
         verbose_name='Prefixes'
         verbose_name='Prefixes'
     )
     )
-    utilization = UtilizationColumn(
+    utilization = columns.UtilizationColumn(
         accessor='get_utilization',
         accessor='get_utilization',
         orderable=False
         orderable=False
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:aggregate_list'
         url_name='ipam:aggregate_list'
     )
     )
 
 
@@ -161,21 +159,21 @@ class AggregateTable(BaseTable):
 #
 #
 
 
 class RoleTable(BaseTable):
 class RoleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    prefix_count = LinkedCountColumn(
+    prefix_count = columns.LinkedCountColumn(
         viewname='ipam:prefix_list',
         viewname='ipam:prefix_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='Prefixes'
         verbose_name='Prefixes'
     )
     )
-    vlan_count = LinkedCountColumn(
+    vlan_count = columns.LinkedCountColumn(
         viewname='ipam:vlan_list',
         viewname='ipam:vlan_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='VLANs'
         verbose_name='VLANs'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:role_list'
         url_name='ipam:role_list'
     )
     )
 
 
@@ -192,7 +190,7 @@ class RoleTable(BaseTable):
 # Prefixes
 # Prefixes
 #
 #
 
 
-class PrefixUtilizationColumn(UtilizationColumn):
+class PrefixUtilizationColumn(columns.UtilizationColumn):
     """
     """
     Extend UtilizationColumn to allow disabling the warning & danger thresholds for prefixes
     Extend UtilizationColumn to allow disabling the warning & danger thresholds for prefixes
     marked as fully utilized.
     marked as fully utilized.
@@ -208,7 +206,7 @@ class PrefixUtilizationColumn(UtilizationColumn):
 
 
 
 
 class PrefixTable(BaseTable):
 class PrefixTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     prefix = tables.TemplateColumn(
     prefix = tables.TemplateColumn(
         template_code=PREFIX_LINK,
         template_code=PREFIX_LINK,
         attrs={'td': {'class': 'text-nowrap'}}
         attrs={'td': {'class': 'text-nowrap'}}
@@ -222,7 +220,7 @@ class PrefixTable(BaseTable):
         accessor=Accessor('_depth'),
         accessor=Accessor('_depth'),
         verbose_name='Depth'
         verbose_name='Depth'
     )
     )
-    children = LinkedCountColumn(
+    children = columns.LinkedCountColumn(
         accessor=Accessor('_children'),
         accessor=Accessor('_children'),
         viewname='ipam:prefix_list',
         viewname='ipam:prefix_list',
         url_params={
         url_params={
@@ -231,7 +229,7 @@ class PrefixTable(BaseTable):
         },
         },
         verbose_name='Children'
         verbose_name='Children'
     )
     )
-    status = ChoiceFieldColumn(
+    status = columns.ChoiceFieldColumn(
         default=AVAILABLE_LABEL
         default=AVAILABLE_LABEL
     )
     )
     vrf = tables.TemplateColumn(
     vrf = tables.TemplateColumn(
@@ -254,17 +252,17 @@ class PrefixTable(BaseTable):
     role = tables.Column(
     role = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    is_pool = BooleanColumn(
+    is_pool = columns.BooleanColumn(
         verbose_name='Pool'
         verbose_name='Pool'
     )
     )
-    mark_utilized = BooleanColumn(
+    mark_utilized = columns.BooleanColumn(
         verbose_name='Marked Utilized'
         verbose_name='Marked Utilized'
     )
     )
     utilization = PrefixUtilizationColumn(
     utilization = PrefixUtilizationColumn(
         accessor='get_utilization',
         accessor='get_utilization',
         orderable=False
         orderable=False
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:prefix_list'
         url_name='ipam:prefix_list'
     )
     )
 
 
@@ -286,7 +284,7 @@ class PrefixTable(BaseTable):
 # IP ranges
 # IP ranges
 #
 #
 class IPRangeTable(BaseTable):
 class IPRangeTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     start_address = tables.Column(
     start_address = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -294,18 +292,18 @@ class IPRangeTable(BaseTable):
         template_code=VRF_LINK,
         template_code=VRF_LINK,
         verbose_name='VRF'
         verbose_name='VRF'
     )
     )
-    status = ChoiceFieldColumn(
+    status = columns.ChoiceFieldColumn(
         default=AVAILABLE_LABEL
         default=AVAILABLE_LABEL
     )
     )
     role = tables.Column(
     role = tables.Column(
         linkify=True
         linkify=True
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    utilization = UtilizationColumn(
+    utilization = columns.UtilizationColumn(
         accessor='utilization',
         accessor='utilization',
         orderable=False
         orderable=False
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:iprange_list'
         url_name='ipam:iprange_list'
     )
     )
 
 
@@ -328,7 +326,7 @@ class IPRangeTable(BaseTable):
 #
 #
 
 
 class IPAddressTable(BaseTable):
 class IPAddressTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     address = tables.TemplateColumn(
     address = tables.TemplateColumn(
         template_code=IPADDRESS_LINK,
         template_code=IPADDRESS_LINK,
         verbose_name='IP Address'
         verbose_name='IP Address'
@@ -337,10 +335,10 @@ class IPAddressTable(BaseTable):
         template_code=VRF_LINK,
         template_code=VRF_LINK,
         verbose_name='VRF'
         verbose_name='VRF'
     )
     )
-    status = ChoiceFieldColumn(
+    status = columns.ChoiceFieldColumn(
         default=AVAILABLE_LABEL
         default=AVAILABLE_LABEL
     )
     )
-    role = ChoiceFieldColumn()
+    role = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
     assigned_object = tables.Column(
     assigned_object = tables.Column(
         linkify=True,
         linkify=True,
@@ -358,12 +356,12 @@ class IPAddressTable(BaseTable):
         orderable=False,
         orderable=False,
         verbose_name='NAT (Inside)'
         verbose_name='NAT (Inside)'
     )
     )
-    assigned = BooleanColumn(
+    assigned = columns.BooleanColumn(
         accessor='assigned_object_id',
         accessor='assigned_object_id',
         linkify=True,
         linkify=True,
         verbose_name='Assigned'
         verbose_name='Assigned'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:ipaddress_list'
         url_name='ipam:ipaddress_list'
     )
     )
 
 
@@ -386,7 +384,7 @@ class IPAddressAssignTable(BaseTable):
         template_code=IPADDRESS_ASSIGN_LINK,
         template_code=IPADDRESS_ASSIGN_LINK,
         verbose_name='IP Address'
         verbose_name='IP Address'
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     assigned_object = tables.Column(
     assigned_object = tables.Column(
         orderable=False
         orderable=False
     )
     )
@@ -410,7 +408,7 @@ class AssignedIPAddressesTable(BaseTable):
         template_code=VRF_LINK,
         template_code=VRF_LINK,
         verbose_name='VRF'
         verbose_name='VRF'
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):

+ 5 - 5
netbox/ipam/tables/services.py

@@ -1,7 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
-from utilities.tables import BaseTable, TagColumn, ToggleColumn
 from ipam.models import *
 from ipam.models import *
+from netbox.tables import BaseTable, columns
 
 
 __all__ = (
 __all__ = (
     'ServiceTable',
     'ServiceTable',
@@ -10,14 +10,14 @@ __all__ = (
 
 
 
 
 class ServiceTemplateTable(BaseTable):
 class ServiceTemplateTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     ports = tables.Column(
     ports = tables.Column(
         accessor=tables.A('port_list')
         accessor=tables.A('port_list')
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:servicetemplate_list'
         url_name='ipam:servicetemplate_list'
     )
     )
 
 
@@ -28,7 +28,7 @@ class ServiceTemplateTable(BaseTable):
 
 
 
 
 class ServiceTable(BaseTable):
 class ServiceTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -39,7 +39,7 @@ class ServiceTable(BaseTable):
     ports = tables.Column(
     ports = tables.Column(
         accessor=tables.A('port_list')
         accessor=tables.A('port_list')
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:service_list'
         url_name='ipam:service_list'
     )
     )
 
 

+ 15 - 18
netbox/ipam/tables/vlans.py

@@ -3,13 +3,10 @@ from django.utils.safestring import mark_safe
 from django_tables2.utils import Accessor
 from django_tables2.utils import Accessor
 
 
 from dcim.models import Interface
 from dcim.models import Interface
+from ipam.models import *
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    ActionsColumn, BaseTable, BooleanColumn, ChoiceFieldColumn, ContentTypeColumn, LinkedCountColumn, TagColumn,
-    TemplateColumn, ToggleColumn,
-)
 from virtualization.models import VMInterface
 from virtualization.models import VMInterface
-from ipam.models import *
 
 
 __all__ = (
 __all__ = (
     'InterfaceVLANTable',
     'InterfaceVLANTable',
@@ -62,22 +59,22 @@ VLAN_MEMBER_TAGGED = """
 #
 #
 
 
 class VLANGroupTable(BaseTable):
 class VLANGroupTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(linkify=True)
     name = tables.Column(linkify=True)
-    scope_type = ContentTypeColumn()
+    scope_type = columns.ContentTypeColumn()
     scope = tables.Column(
     scope = tables.Column(
         linkify=True,
         linkify=True,
         orderable=False
         orderable=False
     )
     )
-    vlan_count = LinkedCountColumn(
+    vlan_count = columns.LinkedCountColumn(
         viewname='ipam:vlan_list',
         viewname='ipam:vlan_list',
         url_params={'group_id': 'pk'},
         url_params={'group_id': 'pk'},
         verbose_name='VLANs'
         verbose_name='VLANs'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:vlangroup_list'
         url_name='ipam:vlangroup_list'
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         extra_buttons=VLANGROUP_BUTTONS
         extra_buttons=VLANGROUP_BUTTONS
     )
     )
 
 
@@ -95,7 +92,7 @@ class VLANGroupTable(BaseTable):
 #
 #
 
 
 class VLANTable(BaseTable):
 class VLANTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     vid = tables.TemplateColumn(
     vid = tables.TemplateColumn(
         template_code=VLAN_LINK,
         template_code=VLAN_LINK,
         verbose_name='VID'
         verbose_name='VID'
@@ -110,18 +107,18 @@ class VLANTable(BaseTable):
         linkify=True
         linkify=True
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    status = ChoiceFieldColumn(
+    status = columns.ChoiceFieldColumn(
         default=AVAILABLE_LABEL
         default=AVAILABLE_LABEL
     )
     )
     role = tables.Column(
     role = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    prefixes = TemplateColumn(
+    prefixes = columns.TemplateColumn(
         template_code=VLAN_PREFIXES,
         template_code=VLAN_PREFIXES,
         orderable=False,
         orderable=False,
         verbose_name='Prefixes'
         verbose_name='Prefixes'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:vlan_list'
         url_name='ipam:vlan_list'
     )
     )
 
 
@@ -155,7 +152,7 @@ class VLANDevicesTable(VLANMembersTable):
     device = tables.Column(
     device = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit',)
         sequence=('edit',)
     )
     )
 
 
@@ -169,7 +166,7 @@ class VLANVirtualMachinesTable(VLANMembersTable):
     virtual_machine = tables.Column(
     virtual_machine = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit',)
         sequence=('edit',)
     )
     )
 
 
@@ -187,7 +184,7 @@ class InterfaceVLANTable(BaseTable):
         linkify=True,
         linkify=True,
         verbose_name='ID'
         verbose_name='ID'
     )
     )
-    tagged = BooleanColumn()
+    tagged = columns.BooleanColumn()
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -196,7 +193,7 @@ class InterfaceVLANTable(BaseTable):
         verbose_name='Group'
         verbose_name='Group'
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     role = tables.Column(
     role = tables.Column(
         linkify=True
         linkify=True
     )
     )

+ 9 - 9
netbox/ipam/tables/vrfs.py

@@ -1,8 +1,8 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
-from tenancy.tables import TenantColumn
-from utilities.tables import BaseTable, BooleanColumn, TagColumn, TemplateColumn, ToggleColumn
 from ipam.models import *
 from ipam.models import *
+from netbox.tables import BaseTable, columns
+from tenancy.tables import TenantColumn
 
 
 __all__ = (
 __all__ = (
     'RouteTargetTable',
     'RouteTargetTable',
@@ -21,7 +21,7 @@ VRF_TARGETS = """
 #
 #
 
 
 class VRFTable(BaseTable):
 class VRFTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -29,18 +29,18 @@ class VRFTable(BaseTable):
         verbose_name='RD'
         verbose_name='RD'
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    enforce_unique = BooleanColumn(
+    enforce_unique = columns.BooleanColumn(
         verbose_name='Unique'
         verbose_name='Unique'
     )
     )
-    import_targets = TemplateColumn(
+    import_targets = columns.TemplateColumn(
         template_code=VRF_TARGETS,
         template_code=VRF_TARGETS,
         orderable=False
         orderable=False
     )
     )
-    export_targets = TemplateColumn(
+    export_targets = columns.TemplateColumn(
         template_code=VRF_TARGETS,
         template_code=VRF_TARGETS,
         orderable=False
         orderable=False
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:vrf_list'
         url_name='ipam:vrf_list'
     )
     )
 
 
@@ -58,12 +58,12 @@ class VRFTable(BaseTable):
 #
 #
 
 
 class RouteTargetTable(BaseTable):
 class RouteTargetTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     tenant = TenantColumn()
     tenant = TenantColumn()
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='ipam:vrf_list'
         url_name='ipam:vrf_list'
     )
     )
 
 

+ 1 - 1
netbox/ipam/views.py

@@ -8,7 +8,7 @@ from dcim.filtersets import InterfaceFilterSet
 from dcim.models import Interface, Site
 from dcim.models import Interface, Site
 from dcim.tables import SiteTable
 from dcim.tables import SiteTable
 from netbox.views import generic
 from netbox.views import generic
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from virtualization.filtersets import VMInterfaceFilterSet
 from virtualization.filtersets import VMInterfaceFilterSet
 from virtualization.models import VMInterface
 from virtualization.models import VMInterface

+ 0 - 10
netbox/utilities/tables/__init__.py → netbox/netbox/tables/__init__.py

@@ -27,13 +27,3 @@ def configure_table(table, request):
         'per_page': get_paginate_count(request)
         'per_page': get_paginate_count(request)
     }
     }
     RequestConfig(request, paginate).configure(table)
     RequestConfig(request, paginate).configure(table)
-
-
-#
-# Callables
-#
-
-def linkify_phone(value):
-    if value is None:
-        return None
-    return f"tel:{value}"

+ 0 - 0
netbox/utilities/tables/columns.py → netbox/netbox/tables/columns.py


+ 1 - 1
netbox/utilities/tables/tables.py → netbox/netbox/tables/tables.py

@@ -7,7 +7,7 @@ from django.db.models.fields.related import RelatedField
 from django_tables2.data import TableQuerysetData
 from django_tables2.data import TableQuerysetData
 
 
 from extras.models import CustomField, CustomLink
 from extras.models import CustomField, CustomLink
-from . import columns
+from netbox.tables import columns
 
 
 __all__ = (
 __all__ = (
     'BaseTable',
     'BaseTable',

+ 1 - 1
netbox/netbox/views/generic/bulk_views.py

@@ -21,7 +21,7 @@ from utilities.forms import (
 )
 )
 from utilities.htmx import is_htmx
 from utilities.htmx import is_htmx
 from utilities.permissions import get_permission_for_model
 from utilities.permissions import get_permission_for_model
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.views import GetReturnURLMixin
 from utilities.views import GetReturnURLMixin
 from .base import BaseMultiObjectView
 from .base import BaseMultiObjectView
 
 

+ 1 - 1
netbox/netbox/views/generic/object_views.py

@@ -18,7 +18,7 @@ from utilities.exceptions import AbortTransaction, PermissionsViolation
 from utilities.forms import ConfirmationForm, ImportForm, restrict_form_fields
 from utilities.forms import ConfirmationForm, ImportForm, restrict_form_fields
 from utilities.htmx import is_htmx
 from utilities.htmx import is_htmx
 from utilities.permissions import get_permission_for_model
 from utilities.permissions import get_permission_for_model
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import normalize_querydict, prepare_cloned_fields
 from utilities.utils import normalize_querydict, prepare_cloned_fields
 from utilities.views import GetReturnURLMixin
 from utilities.views import GetReturnURLMixin
 from .base import BaseObjectView
 from .base import BaseObjectView

+ 20 - 22
netbox/tenancy/tables.py

@@ -1,9 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
-from utilities.tables import (
-    ActionsColumn, BaseTable, ContentTypeColumn, LinkedCountColumn, linkify_phone, MarkdownColumn, MPTTColumn,
-    TagColumn, ToggleColumn,
-)
+from netbox.tables import BaseTable, columns
+from utilities.tables import linkify_phone
 from .models import *
 from .models import *
 
 
 __all__ = (
 __all__ = (
@@ -47,16 +45,16 @@ class TenantColumn(tables.TemplateColumn):
 #
 #
 
 
 class TenantGroupTable(BaseTable):
 class TenantGroupTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
-    tenant_count = LinkedCountColumn(
+    tenant_count = columns.LinkedCountColumn(
         viewname='tenancy:tenant_list',
         viewname='tenancy:tenant_list',
         url_params={'group_id': 'pk'},
         url_params={'group_id': 'pk'},
         verbose_name='Tenants'
         verbose_name='Tenants'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='tenancy:tenantgroup_list'
         url_name='tenancy:tenantgroup_list'
     )
     )
 
 
@@ -69,15 +67,15 @@ class TenantGroupTable(BaseTable):
 
 
 
 
 class TenantTable(BaseTable):
 class TenantTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     group = tables.Column(
     group = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='tenancy:tenant_list'
         url_name='tenancy:tenant_list'
     )
     )
 
 
@@ -92,16 +90,16 @@ class TenantTable(BaseTable):
 #
 #
 
 
 class ContactGroupTable(BaseTable):
 class ContactGroupTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
-    contact_count = LinkedCountColumn(
+    contact_count = columns.LinkedCountColumn(
         viewname='tenancy:contact_list',
         viewname='tenancy:contact_list',
         url_params={'role_id': 'pk'},
         url_params={'role_id': 'pk'},
         verbose_name='Contacts'
         verbose_name='Contacts'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='tenancy:contactgroup_list'
         url_name='tenancy:contactgroup_list'
     )
     )
 
 
@@ -114,7 +112,7 @@ class ContactGroupTable(BaseTable):
 
 
 
 
 class ContactRoleTable(BaseTable):
 class ContactRoleTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -126,7 +124,7 @@ class ContactRoleTable(BaseTable):
 
 
 
 
 class ContactTable(BaseTable):
 class ContactTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -136,11 +134,11 @@ class ContactTable(BaseTable):
     phone = tables.Column(
     phone = tables.Column(
         linkify=linkify_phone,
         linkify=linkify_phone,
     )
     )
-    comments = MarkdownColumn()
+    comments = columns.MarkdownColumn()
     assignment_count = tables.Column(
     assignment_count = tables.Column(
         verbose_name='Assignments'
         verbose_name='Assignments'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='tenancy:tenant_list'
         url_name='tenancy:tenant_list'
     )
     )
 
 
@@ -154,8 +152,8 @@ class ContactTable(BaseTable):
 
 
 
 
 class ContactAssignmentTable(BaseTable):
 class ContactAssignmentTable(BaseTable):
-    pk = ToggleColumn()
-    content_type = ContentTypeColumn(
+    pk = columns.ToggleColumn()
+    content_type = columns.ContentTypeColumn(
         verbose_name='Object Type'
         verbose_name='Object Type'
     )
     )
     object = tables.Column(
     object = tables.Column(
@@ -168,7 +166,7 @@ class ContactAssignmentTable(BaseTable):
     role = tables.Column(
     role = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete')
         sequence=('edit', 'delete')
     )
     )
 
 

+ 1 - 1
netbox/tenancy/views.py

@@ -6,7 +6,7 @@ from circuits.models import Circuit
 from dcim.models import Site, Rack, Device, RackReservation, Cable
 from dcim.models import Site, Rack, Device, RackReservation, Cable
 from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
 from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
 from netbox.views import generic
 from netbox.views import generic
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from virtualization.models import VirtualMachine, Cluster
 from virtualization.models import VirtualMachine, Cluster
 from . import filtersets, forms, tables
 from . import filtersets, forms, tables

+ 1 - 1
netbox/users/tests/test_preferences.py

@@ -6,7 +6,7 @@ from django.urls import reverse
 from dcim.models import Site
 from dcim.models import Site
 from dcim.tables import SiteTable
 from dcim.tables import SiteTable
 from users.preferences import UserPreference
 from users.preferences import UserPreference
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.testing import TestCase
 from utilities.testing import TestCase
 
 
 
 

+ 7 - 0
netbox/utilities/tables.py

@@ -0,0 +1,7 @@
+def linkify_phone(value):
+    """
+    Render a telephone number as a hyperlink.
+    """
+    if value is None:
+        return None
+    return f"tel:{value}"

+ 2 - 2
netbox/utilities/tests/test_tables.py

@@ -2,12 +2,12 @@ from django.template import Context, Template
 from django.test import TestCase
 from django.test import TestCase
 
 
 from dcim.models import Site
 from dcim.models import Site
-from utilities.tables import BaseTable, TagColumn
+from netbox.tables import BaseTable, columns
 from utilities.testing import create_tags
 from utilities.testing import create_tags
 
 
 
 
 class TagColumnTable(BaseTable):
 class TagColumnTable(BaseTable):
-    tags = TagColumn(url_name='dcim:site_list')
+    tags = columns.TagColumn(url_name='dcim:site_list')
 
 
     class Meta(BaseTable.Meta):
     class Meta(BaseTable.Meta):
         model = Site
         model = Site

+ 18 - 21
netbox/virtualization/tables.py

@@ -1,11 +1,8 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
 from dcim.tables.devices import BaseInterfaceTable
 from dcim.tables.devices import BaseInterfaceTable
+from netbox.tables import BaseTable, columns
 from tenancy.tables import TenantColumn
 from tenancy.tables import TenantColumn
-from utilities.tables import (
-    ActionsColumn, BaseTable, ChoiceFieldColumn, ColoredLabelColumn, LinkedCountColumn, MarkdownColumn, TagColumn,
-    ToggleColumn,
-)
 from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
 from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
 
 
 __all__ = (
 __all__ = (
@@ -31,14 +28,14 @@ VMINTERFACE_BUTTONS = """
 #
 #
 
 
 class ClusterTypeTable(BaseTable):
 class ClusterTypeTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     cluster_count = tables.Column(
     cluster_count = tables.Column(
         verbose_name='Clusters'
         verbose_name='Clusters'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='virtualization:clustertype_list'
         url_name='virtualization:clustertype_list'
     )
     )
 
 
@@ -55,14 +52,14 @@ class ClusterTypeTable(BaseTable):
 #
 #
 
 
 class ClusterGroupTable(BaseTable):
 class ClusterGroupTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
     cluster_count = tables.Column(
     cluster_count = tables.Column(
         verbose_name='Clusters'
         verbose_name='Clusters'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='virtualization:clustergroup_list'
         url_name='virtualization:clustergroup_list'
     )
     )
 
 
@@ -79,7 +76,7 @@ class ClusterGroupTable(BaseTable):
 #
 #
 
 
 class ClusterTable(BaseTable):
 class ClusterTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -95,18 +92,18 @@ class ClusterTable(BaseTable):
     site = tables.Column(
     site = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    device_count = LinkedCountColumn(
+    device_count = columns.LinkedCountColumn(
         viewname='dcim:device_list',
         viewname='dcim:device_list',
         url_params={'cluster_id': 'pk'},
         url_params={'cluster_id': 'pk'},
         verbose_name='Devices'
         verbose_name='Devices'
     )
     )
-    vm_count = LinkedCountColumn(
+    vm_count = columns.LinkedCountColumn(
         viewname='virtualization:virtualmachine_list',
         viewname='virtualization:virtualmachine_list',
         url_params={'cluster_id': 'pk'},
         url_params={'cluster_id': 'pk'},
         verbose_name='VMs'
         verbose_name='VMs'
     )
     )
-    comments = MarkdownColumn()
-    tags = TagColumn(
+    comments = columns.MarkdownColumn()
+    tags = columns.TagColumn(
         url_name='virtualization:cluster_list'
         url_name='virtualization:cluster_list'
     )
     )
 
 
@@ -124,18 +121,18 @@ class ClusterTable(BaseTable):
 #
 #
 
 
 class VirtualMachineTable(BaseTable):
 class VirtualMachineTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     name = tables.Column(
     name = tables.Column(
         order_by=('_name',),
         order_by=('_name',),
         linkify=True
         linkify=True
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     cluster = tables.Column(
     cluster = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    role = ColoredLabelColumn()
+    role = columns.ColoredLabelColumn()
     tenant = TenantColumn()
     tenant = TenantColumn()
-    comments = MarkdownColumn()
+    comments = columns.MarkdownColumn()
     primary_ip4 = tables.Column(
     primary_ip4 = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='IPv4 Address'
         verbose_name='IPv4 Address'
@@ -149,7 +146,7 @@ class VirtualMachineTable(BaseTable):
         order_by=('primary_ip4', 'primary_ip6'),
         order_by=('primary_ip4', 'primary_ip6'),
         verbose_name='IP Address'
         verbose_name='IP Address'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='virtualization:virtualmachine_list'
         url_name='virtualization:virtualmachine_list'
     )
     )
 
 
@@ -169,14 +166,14 @@ class VirtualMachineTable(BaseTable):
 #
 #
 
 
 class VMInterfaceTable(BaseInterfaceTable):
 class VMInterfaceTable(BaseInterfaceTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     virtual_machine = tables.Column(
     virtual_machine = tables.Column(
         linkify=True
         linkify=True
     )
     )
     name = tables.Column(
     name = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='virtualization:vminterface_list'
         url_name='virtualization:vminterface_list'
     )
     )
 
 
@@ -196,7 +193,7 @@ class VirtualMachineVMInterfaceTable(VMInterfaceTable):
     bridge = tables.Column(
     bridge = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    actions = ActionsColumn(
+    actions = columns.ActionsColumn(
         sequence=('edit', 'delete'),
         sequence=('edit', 'delete'),
         extra_buttons=VMINTERFACE_BUTTONS
         extra_buttons=VMINTERFACE_BUTTONS
     )
     )

+ 1 - 1
netbox/virtualization/views.py

@@ -11,7 +11,7 @@ from extras.views import ObjectConfigContextView
 from ipam.models import IPAddress, Service
 from ipam.models import IPAddress, Service
 from ipam.tables import AssignedIPAddressesTable, InterfaceVLANTable
 from ipam.tables import AssignedIPAddressesTable, InterfaceVLANTable
 from netbox.views import generic
 from netbox.views import generic
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from . import filtersets, forms, tables
 from . import filtersets, forms, tables
 from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface
 from .models import Cluster, ClusterGroup, ClusterType, VirtualMachine, VMInterface

+ 11 - 11
netbox/wireless/tables.py

@@ -1,7 +1,7 @@
 import django_tables2 as tables
 import django_tables2 as tables
 
 
 from dcim.models import Interface
 from dcim.models import Interface
-from utilities.tables import BaseTable, ChoiceFieldColumn, LinkedCountColumn, MPTTColumn, TagColumn, ToggleColumn
+from netbox.tables import BaseTable, columns
 from .models import *
 from .models import *
 
 
 __all__ = (
 __all__ = (
@@ -12,16 +12,16 @@ __all__ = (
 
 
 
 
 class WirelessLANGroupTable(BaseTable):
 class WirelessLANGroupTable(BaseTable):
-    pk = ToggleColumn()
-    name = MPTTColumn(
+    pk = columns.ToggleColumn()
+    name = columns.MPTTColumn(
         linkify=True
         linkify=True
     )
     )
-    wirelesslan_count = LinkedCountColumn(
+    wirelesslan_count = columns.LinkedCountColumn(
         viewname='wireless:wirelesslan_list',
         viewname='wireless:wirelesslan_list',
         url_params={'group_id': 'pk'},
         url_params={'group_id': 'pk'},
         verbose_name='Wireless LANs'
         verbose_name='Wireless LANs'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='wireless:wirelesslangroup_list'
         url_name='wireless:wirelesslangroup_list'
     )
     )
 
 
@@ -34,7 +34,7 @@ class WirelessLANGroupTable(BaseTable):
 
 
 
 
 class WirelessLANTable(BaseTable):
 class WirelessLANTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     ssid = tables.Column(
     ssid = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -44,7 +44,7 @@ class WirelessLANTable(BaseTable):
     interface_count = tables.Column(
     interface_count = tables.Column(
         verbose_name='Interfaces'
         verbose_name='Interfaces'
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='wireless:wirelesslan_list'
         url_name='wireless:wirelesslan_list'
     )
     )
 
 
@@ -58,7 +58,7 @@ class WirelessLANTable(BaseTable):
 
 
 
 
 class WirelessLANInterfacesTable(BaseTable):
 class WirelessLANInterfacesTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     device = tables.Column(
     device = tables.Column(
         linkify=True
         linkify=True
     )
     )
@@ -73,12 +73,12 @@ class WirelessLANInterfacesTable(BaseTable):
 
 
 
 
 class WirelessLinkTable(BaseTable):
 class WirelessLinkTable(BaseTable):
-    pk = ToggleColumn()
+    pk = columns.ToggleColumn()
     id = tables.Column(
     id = tables.Column(
         linkify=True,
         linkify=True,
         verbose_name='ID'
         verbose_name='ID'
     )
     )
-    status = ChoiceFieldColumn()
+    status = columns.ChoiceFieldColumn()
     device_a = tables.Column(
     device_a = tables.Column(
         accessor=tables.A('interface_a__device'),
         accessor=tables.A('interface_a__device'),
         linkify=True
         linkify=True
@@ -93,7 +93,7 @@ class WirelessLinkTable(BaseTable):
     interface_b = tables.Column(
     interface_b = tables.Column(
         linkify=True
         linkify=True
     )
     )
-    tags = TagColumn(
+    tags = columns.TagColumn(
         url_name='wireless:wirelesslink_list'
         url_name='wireless:wirelesslink_list'
     )
     )
 
 

+ 1 - 1
netbox/wireless/views.py

@@ -1,6 +1,6 @@
 from dcim.models import Interface
 from dcim.models import Interface
 from netbox.views import generic
 from netbox.views import generic
-from utilities.tables import configure_table
+from netbox.tables import configure_table
 from utilities.utils import count_related
 from utilities.utils import count_related
 from . import filtersets, forms, tables
 from . import filtersets, forms, tables
 from .models import *
 from .models import *