[Django]-Make all inline formset forms optional

0👍

If you define the fields in your models as blank=True and null=True and resync your db, there will be no required form fields.

You may need to DROP the tables from your db first, some varients of SQL dbs cannnot have the required attribute changed/updated without completely rebuilding the database from the model. This confused me for a long time on a previous project when I changed some the fields in the models to not be required but the database wasn’t synced to the changes in the model without dropping and rebuilding first (this was SQLite).

#example non-required model field
from django.db import models

class ExampleModel(models.Model):
    first_name = models.CharField(max_length=20, null=True, blank=True)
👤j_syk

Leave a comment