On Thu, Sep 11, 2008 at 8:14 AM, krylatij <[EMAIL PROTECTED]> wrote:

>
> You can create only one model with empty 'other' field.
> If you could  create one more, field 'other'  will not be unique more.
> That's why validation fails.
>

This is not generally true at the database level, as Nathaniel showed by the
fact that he could indeed create multiple objects with null values, just not
via a ModelForm.  From the PostgreSQL doc (
http://www.postgresql.org/docs/8.3/interactive/indexes-unique.html):

"When an index is declared unique, multiple table rows with equal indexed
values will not be allowed. Null values are not considered equal."

and MySQL (http://dev.mysql.com/doc/refman/5.0/en/create-index.html):

"A UNIQUE index creates a constraint such that all values in the index must
be distinct. An error occurs if you try to add a new row with a key value
that matches an existing row. This constraint does not apply to NULL values
except for the BDB storage engine. For other engines, a UNIQUE index allows
multiple NULL values for columns that can contain NULL."

I don't think the ModelForm validation should prohibit something the
databases generally allow. I'd open a ticket (search first though to see if
it's already been reported/decided on...I could be missing something).

Karen

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

Reply via email to