From 1878345992d0272c146cbeec2e62f3ed24907f1e Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Tue, 2 Nov 2021 18:19:03 +0100 Subject: JSON types: multi valued choices --- ishtar_common/forms.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ishtar_common/forms.py') diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 31d1004c7..b92a80f42 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -136,6 +136,7 @@ JSON_VALUE_TYPES_FIELDS = { "D": (DateField, None), "B": (forms.NullBooleanField, None), "C": (widgets.Select2DynamicField, None), + "MC": (widgets.Select2DynamicMultipleField, None), } @@ -312,8 +313,10 @@ class CustomForm(BSForm): attrs["help_text"] = field["help_text"] if widget: attrs["widget"] = widget() - if field_cls == widgets.Select2DynamicField: - attrs["choices"] = cls._get_dynamic_choices(key) + if field_cls in (widgets.Select2DynamicField, + widgets.Select2DynamicMultipleField): + choices = cls._get_dynamic_choices(key) + attrs["choices"] = choices f = field_cls(**attrs) kls = "form-control" if "class" in f.widget.attrs: -- cgit v1.2.3