0
I want to take the field Multiselectfield not mandatory. When I do not choose any of the options the validation is charging mandatory field. I tried to use the parameters Blank=True and null=True, but still accuse that the field is required.
Does anyone know which parameter I should inform for the field Multiselectfield be optional and not mandatory?
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
)
py.models
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)
Gabriel, the title of your question specifies that it is [tag:Django-2.0], but you have put the tag [tag:Django-1.8]. Could you clarify which of the two is what you’re using??
– fernandosavio
I changed kkkk here. I am using the version of Django 2.0.9
– user128174