mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-21 11:37:21 -06:00
Fixes #13871: Fix rack filtering for empty location during device bulk import
This commit is contained in:
parent
9b325f4b86
commit
b670a1e22c
@ -549,9 +549,9 @@ class DeviceImportForm(BaseDeviceImportForm):
|
|||||||
params = {
|
params = {
|
||||||
f"site__{self.fields['site'].to_field_name}": data.get('site'),
|
f"site__{self.fields['site'].to_field_name}": data.get('site'),
|
||||||
}
|
}
|
||||||
if 'location' in data:
|
if location := data.get('location'):
|
||||||
params.update({
|
params.update({
|
||||||
f"location__{self.fields['location'].to_field_name}": data.get('location'),
|
f"location__{self.fields['location'].to_field_name}": location,
|
||||||
})
|
})
|
||||||
self.fields['rack'].queryset = self.fields['rack'].queryset.filter(**params)
|
self.fields['rack'].queryset = self.fields['rack'].queryset.filter(**params)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user