Question

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.

Was it helpful?

Solution

This post should help to understand the difference on blank and null in Django

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top