[Answer]-Django 1.7 – allow null and blank in the database, but do not allow null or blank in admin form

1👍

There’s really no such thing as blank in the database, or null in the admin. null controls whether the database can contain NULL values (not even empty values, just NULL). blank controls whether the admin and modelforms accept empty values.

It seems to me that what you want is simply null=True, blank=False.

👤knbk

0👍

We did this just by change the Model field to not allow null/blank and add default value, and also write a script to add default value to the already existed data whose field is null/blank.

Leave a comment