We encountered the same problem for a complex model ... we ended up 
defining "acceptable" default values that are used instead of None/NULL, 
but essentially mean the same thing to the user.  (We are using MySQL which 
adopts the same approach as Postgresql - I believe Oracle does it 
otherwise).

On Monday, 30 September 2013 23:17:00 UTC+2, Karen Tracey wrote:
>
> On Mon, Sep 30, 2013 at 4:55 PM, Berndt Jung <ber...@brkt.com<javascript:>
> > wrote:
>
>> Because the lookup_value of a null field is None, the validation check is 
>> aborted entirely.  This seems wrong to me, and I'm wondering if I'm doing 
>> something wrong here.  Redefining the models is not something I can do at 
>> this point.
>
>
> None in Python corresponds to NULL in SQL. SQL defines that NULL != NULL. 
> So when checking for unique values the database will not consider two NULLs 
> to be the same value; the NULLs will be considered to be different and will 
> not violate the unique constraint. The Django code is doing the same check 
> for uniquess that the database will be enforcing. There is no way I know of 
> to make a database enforce uniqueness among NULL values...
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/75c02ade-18a4-4e38-a75c-f75b756f831f%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to