[Django]-Inspite of setting (null=True, blank=True) for ModelForm field, I get validation error on leaving the field blank

8👍

Set the field to required=False

class MyForm(ModelForm):
    filing_date = DateField(input_formats=['%d-%m-%Y'],
                            widget=DateInput(format=('%d-%m-%Y'), attrs={'class':'input-block-level datePickBootstrap', 'placeholder':'Filing date'}),
                            required=False)
    class Meta:
        model = try

Leave a comment