mirror of
				https://github.com/netbox-community/netbox.git
				synced 2024-05-10 07:54:54 +00:00 
			
		
		
		
	Fixes #1195: Unable to create an interface connection when searching for peer device
This commit is contained in:
		@@ -1445,7 +1445,7 @@ class InterfaceConnectionForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFor
 | 
			
		||||
        label='Interface',
 | 
			
		||||
        widget=APISelect(
 | 
			
		||||
            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 = {}
 | 
			
		||||
                for db_field, parent_field in field.chains.items():
 | 
			
		||||
                    if self.is_bound:
 | 
			
		||||
                        filters_dict[db_field] = self.data.get(parent_field) or None
 | 
			
		||||
                    if self.is_bound and self.data.get(parent_field):
 | 
			
		||||
                        filters_dict[db_field] = self.data[parent_field]
 | 
			
		||||
                    elif self.initial.get(parent_field):
 | 
			
		||||
                        filters_dict[db_field] = self.initial[parent_field]
 | 
			
		||||
                    else:
 | 
			
		||||
                        filters_dict[db_field] = None
 | 
			
		||||
 | 
			
		||||
                if filters_dict:
 | 
			
		||||
                    field.queryset = field.queryset.filter(**filters_dict)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user