Reputation: 1599
Some model fields such as DateTimeField require null=True option when blank=True option is set.
I'd like to know which fields require that (maybe dependent on backend DBMS), and there is any way to do this automatically.
Upvotes: 2
Views: 441
Reputation: 4515
This post should help to understand the difference on blank
and null
in Django
Upvotes: 2
Reputation: 88757
null=True is used to tell that in DB value can be NULL blank=True is only for django , so django doesn't raise error if field is blank e.g. in admin interface so blank=True has nothing to do with DB NULL requirement will vary from DB to DB, and it is upto you to decide if you want some column NULL or not
Upvotes: 2