mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Fix form initialization for interface import
This commit is contained in:
parent
6abb7e8f4d
commit
eb2da300b0
@ -2978,13 +2978,12 @@ class InterfaceCSVForm(CSVModelForm):
|
|||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Limit LAG choices to interfaces belonging to this device (or VC master)
|
# Limit LAG choices to interfaces belonging to this device (or VC master)
|
||||||
|
device = None
|
||||||
if self.is_bound and 'device' in self.data:
|
if self.is_bound and 'device' in self.data:
|
||||||
try:
|
try:
|
||||||
device = self.fields['device'].to_python(self.data['device'])
|
device = self.fields['device'].to_python(self.data['device'])
|
||||||
except forms.ValidationError:
|
except forms.ValidationError:
|
||||||
device = None
|
pass
|
||||||
else:
|
|
||||||
device = self.instance.device
|
|
||||||
|
|
||||||
if device:
|
if device:
|
||||||
self.fields['lag'].queryset = Interface.objects.filter(
|
self.fields['lag'].queryset = Interface.objects.filter(
|
||||||
|
Loading…
Reference in New Issue
Block a user