From ff2d5d8ea3d1651efff5caec2ad62b0ae9a75555 Mon Sep 17 00:00:00 2001 From: Francesco Filicetti Date: Tue, 14 Feb 2023 18:37:38 +0100 Subject: [PATCH] fix: bug in MultiChoiceField validation --- django_form_builder/dynamic_fields.py | 6 +++++- setup.py | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/django_form_builder/dynamic_fields.py b/django_form_builder/dynamic_fields.py index 052fe41..50b2bff 100644 --- a/django_form_builder/dynamic_fields.py +++ b/django_form_builder/dynamic_fields.py @@ -182,7 +182,11 @@ def define_value(self, choices, **kwargs): self.choices += _split_choices(splitted_string[0]) def clean(self, *args, **kwargs): - # args = args if isinstance(args[0], list) else ([args[0]],) + try: + args = args if isinstance(args[0], list) else ([args[0]],) + if args[0] == None: args = ([],) + except IndexError: + args = ([],) return super().clean(*args, **kwargs) def raise_error(self, name, cleaned_data, **kwargs): diff --git a/setup.py b/setup.py index f54d3f2..f012504 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setup( name='django-form-builder', - version='0.16.12', + version='0.16.13', packages=find_packages(), package_data={'': ['*.wav']}, data_files=[