1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Split out NetBoxTable from BaseTable

This commit is contained in:
jeremystretch
2022-01-27 15:48:05 -05:00
parent 4a1b4e0485
commit 59d3f5c4ea
20 changed files with 218 additions and 254 deletions

View File

@@ -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',)