-------- Forwarded Message --------
From: Malcolm Tredinnick <[EMAIL PROTECTED]>
To: Kilian CAVALOTTI <[EMAIL PROTECTED]>
Subject: Re: unique and blank/null
Date: Mon, 10 Jul 2006 09:26:41 +1000

On Sun, 2006-07-09 at 18:33 +0200, Kilian CAVALOTTI wrote:
> On Saturday 08 July 2006 02:52, Malcolm Tredinnick wrote:
> > You cannot store NULL values via the admin interface. The reason for
> > this is that a web interface is poorly designed as far as being able to
> > differentiate between an empty string and a NULL. If the field is blank,
> > which one did you mean? Empty or NULL? 
> 
> Well, if the field is blank and if I said that I'd like to store NULL values 
> in the model definition, I guess I want to store NULL in the database, not 
> empty strings. If that's not the case, I'm probably good for the pshrink. :)

No; in general (in databases), if you say the field can accept NULLs
then that means you want to be able to store undefined (NULL) values in
there as well as all other values (including empty strings). It does not
say you want empty to strings to be automatically converted to NULLs.
Django follows a similar pattern.

It just happens that in your particular use case, you are
willing/wanting to equate empty strings with NULLs via the web input
interface. We cannot make that assumption in general, so the framework
makes a consistent, documented choice.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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