From 41dfdc0aaa8d0cf39321fa4b31e23f7c958c39ad Mon Sep 17 00:00:00 2001 From: jeremystretch Date: Tue, 21 Sep 2021 09:13:26 -0400 Subject: [PATCH] Fixes #7324: Fix TypeError exception in web UI when filtering objects using single-choice filters --- docs/release-notes/version-3.0.md | 6 ++++++ netbox/utilities/forms/utils.py | 2 ++ 2 files changed, 8 insertions(+) diff --git a/docs/release-notes/version-3.0.md b/docs/release-notes/version-3.0.md index 522a026e3..45c05d4b5 100644 --- a/docs/release-notes/version-3.0.md +++ b/docs/release-notes/version-3.0.md @@ -1,5 +1,11 @@ # NetBox v3.0 +## v3.0.4 (FUTURE) + +### Bug Fixes + +* [#7324](https://github.com/netbox-community/netbox/issues/7324) - Fix TypeError exception in web UI when filtering objects using single-choice filters + ## v3.0.3 (2021-09-20) ### Enhancements diff --git a/netbox/utilities/forms/utils.py b/netbox/utilities/forms/utils.py index 7d2b79f02..343fdb8a3 100644 --- a/netbox/utilities/forms/utils.py +++ b/netbox/utilities/forms/utils.py @@ -137,6 +137,8 @@ def get_selected_values(form, field_name): else: # Static selection field choices = unpack_grouped_choices(field.choices) + if type(filter_data) not in (list, tuple): + filter_data = [filter_data] # Ensure filter data is iterable values = [ label for value, label in choices if str(value) in filter_data or None in filter_data ]