Skip to content

Commit

Permalink
Fixes #13871: Fix rack filtering for empty location during device bul…
Browse files Browse the repository at this point in the history
…k import
  • Loading branch information
jeremystretch committed Sep 25, 2023
1 parent 9b325f4 commit b670a1e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions netbox/dcim/forms/bulk_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -549,9 +549,9 @@ def __init__(self, data=None, *args, **kwargs):
params = {
f"site__{self.fields['site'].to_field_name}": data.get('site'),
}
if 'location' in data:
if location := data.get('location'):
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)

Expand Down

0 comments on commit b670a1e

Please sign in to comment.