Categorized: Database, Django

Optional Date Fields in Django

Adding blank=True on any field in your models.py file will keep the admin interface from requiring that field. That’s all you need to do if it’s a string field. If it’s an integer, boolean, or a date; you need to add null=True to the field as well.

date = models.DateField(blank=True, null=True)

Source

Django model reference

See also

When to use and when not to use NOT NULL in MySQL / Rails Migrations

Comments

Nothing to see here yet. Start things off, why don't you?

What do you think about that?

Elsewhere in the empire: Home, Blog, APOD