mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-20 12:22:23 -06:00
Split out NetBoxTable from BaseTable
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
from ipam.models import *
|
||||
from netbox.tables import BaseTable, columns
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
|
||||
__all__ = (
|
||||
'FHRPGroupTable',
|
||||
@@ -16,8 +16,7 @@ IPADDRESSES = """
|
||||
"""
|
||||
|
||||
|
||||
class FHRPGroupTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class FHRPGroupTable(NetBoxTable):
|
||||
group_id = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -34,7 +33,7 @@ class FHRPGroupTable(BaseTable):
|
||||
url_name='ipam:fhrpgroup_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = FHRPGroup
|
||||
fields = (
|
||||
'pk', 'group_id', 'protocol', 'auth_type', 'auth_key', 'description', 'ip_addresses', 'interface_count',
|
||||
@@ -43,8 +42,7 @@ class FHRPGroupTable(BaseTable):
|
||||
default_columns = ('pk', 'group_id', 'protocol', 'auth_type', 'description', 'ip_addresses', 'interface_count')
|
||||
|
||||
|
||||
class FHRPGroupAssignmentTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class FHRPGroupAssignmentTable(NetBoxTable):
|
||||
interface_parent = tables.Column(
|
||||
accessor=tables.A('interface.parent_object'),
|
||||
linkify=True,
|
||||
@@ -62,7 +60,7 @@ class FHRPGroupAssignmentTable(BaseTable):
|
||||
sequence=('edit', 'delete')
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = FHRPGroupAssignment
|
||||
fields = ('pk', 'group', 'interface_parent', 'interface', 'priority')
|
||||
exclude = ('id',)
|
||||
|
||||
@@ -3,7 +3,7 @@ from django.utils.safestring import mark_safe
|
||||
from django_tables2.utils import Accessor
|
||||
|
||||
from ipam.models import *
|
||||
from netbox.tables import BaseTable, columns
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from tenancy.tables import TenantColumn
|
||||
|
||||
__all__ = (
|
||||
@@ -70,8 +70,7 @@ VRF_LINK = """
|
||||
# RIRs
|
||||
#
|
||||
|
||||
class RIRTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class RIRTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -87,7 +86,7 @@ class RIRTable(BaseTable):
|
||||
url_name='ipam:rir_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = RIR
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'slug', 'is_private', 'aggregate_count', 'description', 'tags', 'created',
|
||||
@@ -100,8 +99,7 @@ class RIRTable(BaseTable):
|
||||
# ASNs
|
||||
#
|
||||
|
||||
class ASNTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class ASNTable(NetBoxTable):
|
||||
asn = tables.Column(
|
||||
accessor=tables.A('asn_asdot'),
|
||||
linkify=True
|
||||
@@ -113,7 +111,7 @@ class ASNTable(BaseTable):
|
||||
verbose_name='Sites'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = ASN
|
||||
fields = ('pk', 'asn', 'rir', 'site_count', 'tenant', 'description', 'created', 'last_updated', 'actions')
|
||||
default_columns = ('pk', 'asn', 'rir', 'site_count', 'sites', 'tenant')
|
||||
@@ -123,8 +121,7 @@ class ASNTable(BaseTable):
|
||||
# Aggregates
|
||||
#
|
||||
|
||||
class AggregateTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class AggregateTable(NetBoxTable):
|
||||
prefix = tables.Column(
|
||||
linkify=True,
|
||||
verbose_name='Aggregate'
|
||||
@@ -145,7 +142,7 @@ class AggregateTable(BaseTable):
|
||||
url_name='ipam:aggregate_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Aggregate
|
||||
fields = (
|
||||
'pk', 'id', 'prefix', 'rir', 'tenant', 'child_count', 'utilization', 'date_added', 'description', 'tags',
|
||||
@@ -158,8 +155,7 @@ class AggregateTable(BaseTable):
|
||||
# Roles
|
||||
#
|
||||
|
||||
class RoleTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class RoleTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -177,7 +173,7 @@ class RoleTable(BaseTable):
|
||||
url_name='ipam:role_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Role
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'slug', 'prefix_count', 'vlan_count', 'description', 'weight', 'tags', 'created',
|
||||
@@ -205,8 +201,7 @@ class PrefixUtilizationColumn(columns.UtilizationColumn):
|
||||
"""
|
||||
|
||||
|
||||
class PrefixTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class PrefixTable(NetBoxTable):
|
||||
prefix = tables.TemplateColumn(
|
||||
template_code=PREFIX_LINK,
|
||||
attrs={'td': {'class': 'text-nowrap'}}
|
||||
@@ -266,7 +261,7 @@ class PrefixTable(BaseTable):
|
||||
url_name='ipam:prefix_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Prefix
|
||||
fields = (
|
||||
'pk', 'id', 'prefix', 'prefix_flat', 'status', 'children', 'vrf', 'utilization', 'tenant', 'site',
|
||||
@@ -283,8 +278,7 @@ class PrefixTable(BaseTable):
|
||||
#
|
||||
# IP ranges
|
||||
#
|
||||
class IPRangeTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class IPRangeTable(NetBoxTable):
|
||||
start_address = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -307,7 +301,7 @@ class IPRangeTable(BaseTable):
|
||||
url_name='ipam:iprange_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = IPRange
|
||||
fields = (
|
||||
'pk', 'id', 'start_address', 'end_address', 'size', 'vrf', 'status', 'role', 'tenant', 'description',
|
||||
@@ -325,8 +319,7 @@ class IPRangeTable(BaseTable):
|
||||
# IPAddresses
|
||||
#
|
||||
|
||||
class IPAddressTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class IPAddressTable(NetBoxTable):
|
||||
address = tables.TemplateColumn(
|
||||
template_code=IPADDRESS_LINK,
|
||||
verbose_name='IP Address'
|
||||
@@ -365,7 +358,7 @@ class IPAddressTable(BaseTable):
|
||||
url_name='ipam:ipaddress_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = IPAddress
|
||||
fields = (
|
||||
'pk', 'id', 'address', 'vrf', 'status', 'role', 'tenant', 'nat_inside', 'assigned', 'dns_name', 'description',
|
||||
@@ -379,7 +372,7 @@ class IPAddressTable(BaseTable):
|
||||
}
|
||||
|
||||
|
||||
class IPAddressAssignTable(BaseTable):
|
||||
class IPAddressAssignTable(NetBoxTable):
|
||||
address = tables.TemplateColumn(
|
||||
template_code=IPADDRESS_ASSIGN_LINK,
|
||||
verbose_name='IP Address'
|
||||
@@ -389,14 +382,14 @@ class IPAddressAssignTable(BaseTable):
|
||||
orderable=False
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = IPAddress
|
||||
fields = ('address', 'dns_name', 'vrf', 'status', 'role', 'tenant', 'assigned_object', 'description')
|
||||
exclude = ('id', )
|
||||
orderable = False
|
||||
|
||||
|
||||
class AssignedIPAddressesTable(BaseTable):
|
||||
class AssignedIPAddressesTable(NetBoxTable):
|
||||
"""
|
||||
List IP addresses assigned to an object.
|
||||
"""
|
||||
@@ -411,7 +404,7 @@ class AssignedIPAddressesTable(BaseTable):
|
||||
status = columns.ChoiceFieldColumn()
|
||||
tenant = TenantColumn()
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = IPAddress
|
||||
fields = ('address', 'vrf', 'status', 'role', 'tenant', 'description')
|
||||
exclude = ('id', )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
from ipam.models import *
|
||||
from netbox.tables import BaseTable, columns
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
|
||||
__all__ = (
|
||||
'ServiceTable',
|
||||
@@ -9,8 +9,7 @@ __all__ = (
|
||||
)
|
||||
|
||||
|
||||
class ServiceTemplateTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class ServiceTemplateTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -21,14 +20,13 @@ class ServiceTemplateTable(BaseTable):
|
||||
url_name='ipam:servicetemplate_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = ServiceTemplate
|
||||
fields = ('pk', 'id', 'name', 'protocol', 'ports', 'description', 'tags')
|
||||
default_columns = ('pk', 'name', 'protocol', 'ports', 'description')
|
||||
|
||||
|
||||
class ServiceTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class ServiceTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -43,7 +41,7 @@ class ServiceTable(BaseTable):
|
||||
url_name='ipam:service_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Service
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'parent', 'protocol', 'ports', 'ipaddresses', 'description', 'tags', 'created',
|
||||
|
||||
@@ -4,7 +4,7 @@ from django_tables2.utils import Accessor
|
||||
|
||||
from dcim.models import Interface
|
||||
from ipam.models import *
|
||||
from netbox.tables import BaseTable, columns
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from tenancy.tables import TenantColumn
|
||||
from virtualization.models import VMInterface
|
||||
|
||||
@@ -58,8 +58,7 @@ VLAN_MEMBER_TAGGED = """
|
||||
# VLAN groups
|
||||
#
|
||||
|
||||
class VLANGroupTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class VLANGroupTable(NetBoxTable):
|
||||
name = tables.Column(linkify=True)
|
||||
scope_type = columns.ContentTypeColumn()
|
||||
scope = tables.Column(
|
||||
@@ -78,7 +77,7 @@ class VLANGroupTable(BaseTable):
|
||||
extra_buttons=VLANGROUP_BUTTONS
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VLANGroup
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'scope_type', 'scope', 'min_vid', 'max_vid', 'vlan_count', 'slug', 'description',
|
||||
@@ -91,8 +90,7 @@ class VLANGroupTable(BaseTable):
|
||||
# VLANs
|
||||
#
|
||||
|
||||
class VLANTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class VLANTable(NetBoxTable):
|
||||
vid = tables.TemplateColumn(
|
||||
template_code=VLAN_LINK,
|
||||
verbose_name='VID'
|
||||
@@ -122,7 +120,7 @@ class VLANTable(BaseTable):
|
||||
url_name='ipam:vlan_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VLAN
|
||||
fields = (
|
||||
'pk', 'id', 'vid', 'name', 'site', 'group', 'prefixes', 'tenant', 'status', 'role', 'description', 'tags',
|
||||
@@ -134,7 +132,7 @@ class VLANTable(BaseTable):
|
||||
}
|
||||
|
||||
|
||||
class VLANMembersTable(BaseTable):
|
||||
class VLANMembersTable(NetBoxTable):
|
||||
"""
|
||||
Base table for Interface and VMInterface assignments
|
||||
"""
|
||||
@@ -156,7 +154,7 @@ class VLANDevicesTable(VLANMembersTable):
|
||||
sequence=('edit',)
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = Interface
|
||||
fields = ('device', 'name', 'tagged', 'actions')
|
||||
exclude = ('id', )
|
||||
@@ -170,13 +168,13 @@ class VLANVirtualMachinesTable(VLANMembersTable):
|
||||
sequence=('edit',)
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VMInterface
|
||||
fields = ('virtual_machine', 'name', 'tagged', 'actions')
|
||||
exclude = ('id', )
|
||||
|
||||
|
||||
class InterfaceVLANTable(BaseTable):
|
||||
class InterfaceVLANTable(NetBoxTable):
|
||||
"""
|
||||
List VLANs assigned to a specific Interface.
|
||||
"""
|
||||
@@ -198,7 +196,7 @@ class InterfaceVLANTable(BaseTable):
|
||||
linkify=True
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VLAN
|
||||
fields = ('vid', 'tagged', 'site', 'group', 'name', 'tenant', 'status', 'role', 'description')
|
||||
exclude = ('id', )
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
from ipam.models import *
|
||||
from netbox.tables import BaseTable, columns
|
||||
from netbox.tables import NetBoxTable, columns
|
||||
from tenancy.tables import TenantColumn
|
||||
|
||||
__all__ = (
|
||||
@@ -20,8 +20,7 @@ VRF_TARGETS = """
|
||||
# VRFs
|
||||
#
|
||||
|
||||
class VRFTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class VRFTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -44,7 +43,7 @@ class VRFTable(BaseTable):
|
||||
url_name='ipam:vrf_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = VRF
|
||||
fields = (
|
||||
'pk', 'id', 'name', 'rd', 'tenant', 'enforce_unique', 'description', 'import_targets', 'export_targets',
|
||||
@@ -57,8 +56,7 @@ class VRFTable(BaseTable):
|
||||
# Route targets
|
||||
#
|
||||
|
||||
class RouteTargetTable(BaseTable):
|
||||
pk = columns.ToggleColumn()
|
||||
class RouteTargetTable(NetBoxTable):
|
||||
name = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
@@ -67,7 +65,7 @@ class RouteTargetTable(BaseTable):
|
||||
url_name='ipam:vrf_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = RouteTarget
|
||||
fields = ('pk', 'id', 'name', 'tenant', 'description', 'tags', 'created', 'last_updated',)
|
||||
default_columns = ('pk', 'name', 'tenant', 'description')
|
||||
|
||||
Reference in New Issue
Block a user