I want to make the MultiSelectField field not mandatory. When I do not choose any of the options the validation is accusing Required field . I've tried using the parameters blank = True and null = True, but still continue to accuse the field is required.
Does anyone know which parameter should I enter for the MultiSelectField field to be optional and not required?
forms.py
class MyForm(forms.ModelForm):
MY_CHOICES = (
('1', "A good choice"),
('2', "A bad choice"),
)
my_field = forms.MultipleChoiceField(
label='Escolhas', widget=forms.CheckboxSelectMultiple, choices=MY_CHOICE
)
models.py
from multiselectfield import MultiSelectField
class MyModel(models.Model):
MY_CHOICES = (
('1', "A good choice"),
('2', "A bad choice"),
)
my_field = MultiSelectField('Escolhas', choices=MY_CHOICES, default=0)