From 497e50c55974b48a24fd3f0b62e63cba36763a88 Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Mon, 19 Apr 2021 16:55:57 -0400 Subject: [PATCH] Closes #6190: Allow filtering devices with no location assigned --- docs/release-notes/version-2.11.md | 1 + netbox/dcim/forms.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/release-notes/version-2.11.md b/docs/release-notes/version-2.11.md index c515eba8e..2092ea0a5 100644 --- a/docs/release-notes/version-2.11.md +++ b/docs/release-notes/version-2.11.md @@ -5,6 +5,7 @@ ### Enhancements * [#6189](https://github.com/netbox-community/netbox/issues/6189) - Add ability to search for locations by name or description +* [#6190](https://github.com/netbox-community/netbox/issues/6190) - Allow filtering devices with no location assigned ### Bug Fixes diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index d63106fbf..d6799b6c9 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -2429,10 +2429,11 @@ class DeviceFilterForm(BootstrapMixin, LocalConfigContextFilterForm, TenancyFilt location_id = DynamicModelMultipleChoiceField( queryset=Location.objects.all(), required=False, - label=_('Location'), + null_option='None', query_params={ 'site_id': '$site_id' - } + }, + label=_('Location') ) rack_id = DynamicModelMultipleChoiceField( queryset=Rack.objects.all(),