mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
fixed form bound check for site and vlan group
This commit is contained in:
parent
970759ed8b
commit
3cb351dceb
@ -1728,10 +1728,10 @@ class InterfaceForm(BootstrapMixin, forms.ModelForm, ChainedFieldsMixin):
|
||||
self.fields['site'].initial = None
|
||||
|
||||
# Limit the initial vlan choices
|
||||
if self.is_bound:
|
||||
if self.is_bound and self.data.get('vlan_group') and self.data.get('site'):
|
||||
filter_dict = {
|
||||
'group_id': self.data.get('vlan_group') or None,
|
||||
'site_id': self.data.get('site') or None,
|
||||
'group_id': self.data.get('vlan_group'),
|
||||
'site_id': self.data.get('site'),
|
||||
}
|
||||
elif self.initial.get('untagged_vlan'):
|
||||
filter_dict = {
|
||||
@ -1854,10 +1854,10 @@ class InterfaceCreateForm(ComponentForm, ChainedFieldsMixin):
|
||||
self.fields['site'].initial = None
|
||||
|
||||
# Limit the initial vlan choices
|
||||
if self.is_bound:
|
||||
if self.is_bound and self.data.get('vlan_group') and self.data.get('site'):
|
||||
filter_dict = {
|
||||
'group_id': self.data.get('vlan_group') or None,
|
||||
'site_id': self.data.get('site') or None,
|
||||
'group_id': self.data.get('vlan_group'),
|
||||
'site_id': self.data.get('site'),
|
||||
}
|
||||
elif self.initial.get('untagged_vlan'):
|
||||
filter_dict = {
|
||||
@ -1968,10 +1968,10 @@ class InterfaceBulkEditForm(BootstrapMixin, BulkEditForm, ChainedFieldsMixin):
|
||||
self.fields['site'].queryset = Site.objects.none()
|
||||
self.fields['site'].initial = None
|
||||
|
||||
if self.is_bound:
|
||||
if self.is_bound and self.data.get('vlan_group') and self.data.get('site'):
|
||||
filter_dict = {
|
||||
'group_id': self.data.get('vlan_group') or None,
|
||||
'site_id': self.data.get('site') or None,
|
||||
'group_id': self.data.get('vlan_group'),
|
||||
'site_id': self.data.get('site'),
|
||||
}
|
||||
else:
|
||||
filter_dict = {
|
||||
|
Loading…
Reference in New Issue
Block a user