Whoops. Didn't reply to group automatically (now I discovered some new and interesting behaviour in the way Evolution prioritises reply fields).
-------- Forwarded Message -------- From: Malcolm Tredinnick <[EMAIL PROTECTED]> To: Kilian CAVALOTTI <[EMAIL PROTECTED]> Subject: Re: unique and blank/null Date: Sat, 08 Jul 2006 10:52:30 +1000 On Fri, 2006-07-07 at 16:02 +0200, Kilian CAVALOTTI wrote: > On Friday 07 July 2006 12:57, Malcolm Tredinnick wrote: > > Maybe there is some oddity about your circumstances. Can you post more > > details if you are really seeing NULL values being treated distinctly, > > please? > > Actually, it may not been SQLite related, after all. I narrowed the problem > to > the way the admin interface create empty fields in the database. Those NULL > values are not really NULL. To quote from the documentation (for the "null" attribute): "Note that empty string values will always get stored as empty strings, not as NULL -- so use null=True for non-string fields such as integers, booleans and dates." 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? So Django always makes it an empty string for character-based fields. You can still declare this fields as "null = True" so that legacy databases and input from other systems can be handled: they can insert NULLs and the column is able to accept them. 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 -~----------~----~----~----~------~----~------~--~---