From 625bd41babdb63380ee98e81843a346ef35136b5 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 25 Sep 2023 10:25:05 -0400 Subject: [PATCH] Fixes #13871: Fix rack filtering for empty location during device bulk import --- netbox/dcim/forms/bulk_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index 74af0696b88..70aceaa49fa 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -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)