mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Fixes #1072: Order LAG interfaces naturally on bulk interface edit form
This commit is contained in:
parent
6dcc5a1169
commit
7cbea49c2d
@ -1422,9 +1422,16 @@ class InterfaceBulkEditForm(BootstrapMixin, BulkEditForm):
|
|||||||
super(InterfaceBulkEditForm, self).__init__(*args, **kwargs)
|
super(InterfaceBulkEditForm, self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Limit LAG choices to interfaces which belong to the parent device.
|
# Limit LAG choices to interfaces which belong to the parent device.
|
||||||
|
device = None
|
||||||
if self.initial.get('device'):
|
if self.initial.get('device'):
|
||||||
self.fields['lag'].queryset = Interface.objects.filter(
|
try:
|
||||||
device=self.initial['device'], form_factor=IFACE_FF_LAG
|
device = Device.objects.get(pk=self.initial.get('device'))
|
||||||
|
except Device.DoesNotExist:
|
||||||
|
pass
|
||||||
|
if device is not None:
|
||||||
|
interface_ordering = device.device_type.interface_ordering
|
||||||
|
self.fields['lag'].queryset = Interface.objects.order_naturally(method=interface_ordering).filter(
|
||||||
|
device=device, form_factor=IFACE_FF_LAG
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
self.fields['lag'].choices = []
|
self.fields['lag'].choices = []
|
||||||
|
Loading…
Reference in New Issue
Block a user