diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-02 18:19:03 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2021-11-16 17:04:41 +0100 |
commit | 64bbb0f222ccdb18d20b95d9c58c8228eca22f0b (patch) | |
tree | db7cc24e1a8d1a119cd78befac2165edbd3d6788 /ishtar_common/forms.py | |
parent | a6bd637b8bf662d12d96609c018a4e6cb048ee2a (diff) | |
download | Ishtar-64bbb0f222ccdb18d20b95d9c58c8228eca22f0b.tar.bz2 Ishtar-64bbb0f222ccdb18d20b95d9c58c8228eca22f0b.zip |
JSON types: multi valued choices
Diffstat (limited to 'ishtar_common/forms.py')
-rw-r--r-- | ishtar_common/forms.py | 7 |
1 files changed, 5 insertions, 2 deletions
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: |