Skip to content

Entries published on June 28, 2006

1 entry published on this date. See also: all entries published in June 2006, full archive.

Django tips: the difference between ‘blank’ and ‘null’

New users of Django, even people who have lots of experience writing database-driven applications, often run into a seemingly simple problem: how do you set up a model with “optional” fields that don’t always have to be filled in? Django’s validation system assumes by default that all fields are required, so obviously you have to tell it which fields it’s OK to leave blank.

But therein lies the problem: there are two different ways you can “leave it blank”.

There’s nothing…

For the most part, assuming that fields should be required is a good idea; it’s easier to go back and mark something …

Entry published June 28, 2006. Read full entry.