Skip to content

Commit b670a1e

Browse files
committed
Fixes #13871: Fix rack filtering for empty location during device bulk import
1 parent 9b325f4 commit b670a1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

netbox/dcim/forms/bulk_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -549,9 +549,9 @@ def __init__(self, data=None, *args, **kwargs):
549549
params = {
550550
f"site__{self.fields['site'].to_field_name}": data.get('site'),
551551
}
552-
if 'location' in data:
552+
if location := data.get('location'):
553553
params.update({
554-
f"location__{self.fields['location'].to_field_name}": data.get('location'),
554+
f"location__{self.fields['location'].to_field_name}": location,
555555
})
556556
self.fields['rack'].queryset = self.fields['rack'].queryset.filter(**params)
557557

0 commit comments

Comments
 (0)