On 8/14/06, Rares Vernica <[EMAIL PROTECTED]> wrote:
> I have a DateField with blank=True and after I complete and submit the
> form I get a Django error saying that DateField cannot be null?

As the model documentation points out, you must also set 'null=True'
on the field to have the database accept NULL values; 'blank' is for
admin validation only, and has no effect on whether the database will
accept NULL.

The distinction is necessary to allow situations where a field can be
left blank via initial user input, but still requires that something
else fill it in before saving (for example, you might want to have a
field the user can fill in, but which will be filled with a default or
automatically-calculated value when left blank).

> I don't like the idea of manually going and changing the DB schema.

The column in the database will have been created with a NOT NULL
constraint; that constraint can only be removed by executing the
appropriate SQL statement for the database you're using.

-- 
"May the forces of evil become confused on the way to your house."
  -- George Carlin

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to