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

Closes #6121: Extend parent interface assignment to VM interfaces

This commit is contained in:
jeremystretch
2021-04-09 10:53:05 -04:00
parent 7439faad34
commit a3721a94ce
13 changed files with 128 additions and 18 deletions

View File

@ -421,6 +421,14 @@ class VMInterfaceView(generic.ObjectView):
orderable=False
)
# Get child interfaces
child_interfaces = VMInterface.objects.restrict(request.user, 'view').filter(parent=instance)
child_interfaces_tables = tables.VMInterfaceTable(
child_interfaces,
orderable=False
)
child_interfaces_tables.columns.hide('virtual_machine')
# Get assigned VLANs and annotate whether each is tagged or untagged
vlans = []
if instance.untagged_vlan is not None:
@ -437,6 +445,7 @@ class VMInterfaceView(generic.ObjectView):
return {
'ipaddress_table': ipaddress_table,
'child_interfaces_table': child_interfaces_tables,
'vlan_table': vlan_table,
}