On 9/9/06, cyberco <[EMAIL PROTECTED]> wrote: > Thank you! That is a pretty obscure method.
It's obscure but it's necessary; the way Django parses the lookup parameters will drop any parameter of the form 'somefield=None', so that the parameter never makes it into the eventual database query (have a look at the function 'parse_lookup' in django/db/models/query.py to see code which does this -- it's line 710 in that file in the current trunk). I don't know exactly, but I'd imagine that the reason for this is that testing for null values is a special operation in SQL -- in your example, the correct query would be 'WHERE t_id IS NULL'; the 'isnull' lookup method in Django's database API implements this directly (and, if you do 'isnull=False', implements the opposite, 'WHERE t_id IS NOT NULL'). Documentation for it is here: http://www.djangoproject.com/documentation/db_api/#isnull -- "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 -~----------~----~----~----~------~----~------~--~---