mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -06:00
Fixes #1195: Unable to create an interface connection when searching for peer device
This commit is contained in:
parent
feac93389c
commit
7fa696dace
@ -1445,7 +1445,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
|
|||||||
label='Interface',
|
label='Interface',
|
||||||
widget=APISelect(
|
widget=APISelect(
|
||||||
api_url='/api/dcim/interfaces/?device_id={{device_b}}&type=physical',
|
api_url='/api/dcim/interfaces/?device_id={{device_b}}&type=physical',
|
||||||
disabled_indicator='is_connected'
|
disabled_indicator='connection'
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -443,12 +443,10 @@ class ChainedFieldsMixin(forms.BaseForm):
|
|||||||
|
|
||||||
filters_dict = {}
|
filters_dict = {}
|
||||||
for db_field, parent_field in field.chains.items():
|
for db_field, parent_field in field.chains.items():
|
||||||
if self.is_bound:
|
if self.is_bound and self.data.get(parent_field):
|
||||||
filters_dict[db_field] = self.data.get(parent_field) or None
|
filters_dict[db_field] = self.data[parent_field]
|
||||||
elif self.initial.get(parent_field):
|
elif self.initial.get(parent_field):
|
||||||
filters_dict[db_field] = self.initial[parent_field]
|
filters_dict[db_field] = self.initial[parent_field]
|
||||||
else:
|
|
||||||
filters_dict[db_field] = None
|
|
||||||
|
|
||||||
if filters_dict:
|
if filters_dict:
|
||||||
field.queryset = field.queryset.filter(**filters_dict)
|
field.queryset = field.queryset.filter(**filters_dict)
|
||||||
|
Loading…
Reference in New Issue
Block a user