[Django]-How can I make my model fields optional in Django?


You would have to add blank=True as well in field definition.

date_of_birth = models.DateField(null=True, blank=True)

From modelform doc

If the model field has blank=True, then required is set to False on the form field. Otherwise, required=True.

Don’t forget to reset and sync DB again after changing this.


Leave a comment