[Django]-Django Model Field Default to Null

145👍

Try default=None. There is no NULL in python.

40👍

If you specify null=True on the model field then the value will be stored as NULL in the database if the user does not provide a value.

👤Kevin

26👍

  • blank=True
    allows you to input nothing (i.e "", None) and keep it empty.
  • null=True
    means the database row is allowed to be NULL.
  • default=None
    sets the field to None if no other value is given.

Leave a comment