If you set null=True
, it will allow the value of your database column to be set as NULL
. If you only set blank=True
, django will set the default new value for the column equal to ""
.
There's one point where null=True
would be necessary even on a CharField
or TextField
and that is when the database has the unique
flag set for the column. In this case you'll need to use this:
a_unique_string = models.CharField(blank=True, null=True, unique=True)
Preferrably skip the null=True
for non-unique CharField
or TextField
. Otherwise some fields will be set as NULL
while others as ""
, and you'll have to check the field value for NULL
everytime.