mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Initial work on #6235
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
from .fhrp import *
|
||||
from .ip import *
|
||||
from .services import *
|
||||
from .vlans import *
|
||||
|
64
netbox/ipam/tables/fhrp.py
Normal file
64
netbox/ipam/tables/fhrp.py
Normal file
@ -0,0 +1,64 @@
|
||||
import django_tables2 as tables
|
||||
|
||||
from utilities.tables import (
|
||||
BaseTable, ContentTypeColumn, MarkdownColumn, TagColumn, ToggleColumn,
|
||||
)
|
||||
from ipam.models import *
|
||||
|
||||
__all__ = (
|
||||
'FHRPGroupTable',
|
||||
'FHRPGroupAssignmentTable',
|
||||
)
|
||||
|
||||
|
||||
IPADDRESSES = """
|
||||
{% for ip in record.ip_addresses.all %}
|
||||
<a href="{{ ip.get_absolute_url }}">{{ ip }}</a><br />
|
||||
{% endfor %}
|
||||
"""
|
||||
|
||||
|
||||
class FHRPGroupTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
group_id = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
comments = MarkdownColumn()
|
||||
ip_addresses = tables.TemplateColumn(
|
||||
template_code=IPADDRESSES,
|
||||
orderable=False,
|
||||
verbose_name='IP Addresses'
|
||||
)
|
||||
member_count = tables.Column(
|
||||
verbose_name='Members'
|
||||
)
|
||||
tags = TagColumn(
|
||||
url_name='ipam:fhrpgroup_list'
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = FHRPGroup
|
||||
fields = (
|
||||
'pk', 'group_id', 'protocol', 'auth_type', 'auth_key', 'description', 'ip_addresses', 'member_count',
|
||||
'tags',
|
||||
)
|
||||
default_columns = ('pk', 'group_id', 'protocol', 'auth_type', 'description', 'ip_addresses', 'member_count')
|
||||
|
||||
|
||||
class FHRPGroupAssignmentTable(BaseTable):
|
||||
pk = ToggleColumn()
|
||||
content_type = ContentTypeColumn(
|
||||
verbose_name='Object Type'
|
||||
)
|
||||
object = tables.Column(
|
||||
linkify=True,
|
||||
orderable=False
|
||||
)
|
||||
group = tables.Column(
|
||||
linkify=True
|
||||
)
|
||||
|
||||
class Meta(BaseTable.Meta):
|
||||
model = FHRPGroupAssignment
|
||||
fields = ('pk', 'content_type', 'object', 'group', 'priority')
|
||||
default_columns = ('pk', 'content_type', 'object', 'group', 'priority')
|
@ -11,7 +11,7 @@ from ipam.models import *
|
||||
|
||||
__all__ = (
|
||||
'AggregateTable',
|
||||
'InterfaceIPAddressTable',
|
||||
'AssignedIPAddressesTable',
|
||||
'IPAddressAssignTable',
|
||||
'IPAddressTable',
|
||||
'IPRangeTable',
|
||||
@ -359,9 +359,9 @@ class IPAddressAssignTable(BaseTable):
|
||||
orderable = False
|
||||
|
||||
|
||||
class InterfaceIPAddressTable(BaseTable):
|
||||
class AssignedIPAddressesTable(BaseTable):
|
||||
"""
|
||||
List IP addresses assigned to a specific Interface.
|
||||
List IP addresses assigned to an object.
|
||||
"""
|
||||
address = tables.Column(
|
||||
linkify=True,
|
||||
|
Reference in New Issue
Block a user