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

Closes #2057: Added description columns to interface connections list

This commit is contained in:
Jeremy Stretch
2018-11-05 14:41:51 -05:00
parent 82076d3ca6
commit e57b3bc4ab
3 changed files with 12 additions and 1 deletions

View File

@@ -716,6 +716,10 @@ class InterfaceConnectionTable(BaseTable):
args=[Accessor('pk')],
verbose_name='Interface A'
)
description_a = tables.Column(
accessor=Accessor('description'),
verbose_name='Description'
)
device_b = tables.LinkColumn(
viewname='dcim:device',
accessor=Accessor('connected_endpoint.device'),
@@ -728,6 +732,10 @@ class InterfaceConnectionTable(BaseTable):
args=[Accessor('connected_endpoint.pk')],
verbose_name='Interface B'
)
description_b = tables.Column(
accessor=Accessor('connected_endpoint.description'),
verbose_name='Description'
)
cable = tables.LinkColumn(
viewname='dcim:cable',
args=[Accessor('cable.pk')]
@@ -735,7 +743,7 @@ class InterfaceConnectionTable(BaseTable):
class Meta(BaseTable.Meta):
model = Interface
fields = ('device_a', 'interface_a', 'device_b', 'interface_b', 'cable')
fields = ('device_a', 'interface_a', 'description_a', 'device_b', 'interface_b', 'description_b', 'cable')
#

View File

@@ -1732,6 +1732,8 @@ class InterfaceConnectionsListView(ObjectListView):
# Avoid duplicate connections by only selecting the lower PK in a connected pair
_connected_interface__isnull=False,
pk__lt=F('_connected_interface')
).order_by(
'device'
)
filter = filters.InterfaceConnectionFilter
filter_form = forms.InterfaceConnectionFilterForm