From 25d126d4ff91d7022dee3ff601ddbd685211021a Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 24 Feb 2020 09:31:31 -0500 Subject: [PATCH] Call prepare_value() to avoid passing model instances directly to the filterset --- netbox/utilities/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/utilities/forms.py b/netbox/utilities/forms.py index 71c262cdc..c57996a43 100644 --- a/netbox/utilities/forms.py +++ b/netbox/utilities/forms.py @@ -572,7 +572,7 @@ class DynamicModelChoiceMixin: # Modify the QuerySet of the field before we return it. Limit choices to any data already bound: Options # will be populated on-demand via the APISelect widget. - data = bound_field.data or bound_field.initial + data = self.prepare_value(bound_field.data or bound_field.initial) if data: filter = self.filter(field_name=self.to_field_name or 'pk', queryset=self.queryset) self.queryset = filter.filter(self.queryset, data)