Make all inline forms forms optional

I have an article form that can contain 0-5 images, so I use the usual form for the article and a set of forms for the images. Is there a way to make this optional to fill out any form information in the image form set? When I leave them, I get validation errors that I did not issue from the required fields.

+4
source share
1 answer

If you define the fields in your models as blank = True and null = True and re-synchronize your db, there will be no fields of the required shape.

You may need to drop the tables from your db first, but some SQL dbs variables cannot change or update the required attribute without completely rebuilding the database from the model. This confused me for a long time in the previous project, when I changed some fields in the models so that they weren’t required, but the database was not synchronized with the changes in the model without dropping or rebuilding first (it 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) 
0
source

All Articles