Hi all,

I am having trouble with a Q object look up in one of my apps. When I
execute the following:

Tag.objects.filter(Q(card__owner = u)|Q(usercardmeta__user = u))

an empty queryset is returned. The filtered QuerySet should be
returning this list:

[<Tag: test (0)>, <Tag: tag-2 (0)>, <Tag: test2 (0)>, <Tag: testtag
(0)>]

After stepping through and grokking the code I think I have pinned the
problem down to this line the QuerySet method _filter_or_exclude:

clone._filters = clone._filters & reduce(operator.and_, map(mapper,
args))long

It appears that when the clone._filters and reduce() result are &'d
together I am losing the QOr results because clone._filters is an
"empty" Q object. At least that what it appears to be to me. This looks
like it might fall under the ticket #2253 though I have not actually
tried the problem described in the ticket. Should there be a check in
the _filter_or_exclude method to see if clone._filters is an "empty" Q
object and if so just assign the reduce() result to clone._filters
directly?

Thanks,
Aaron Farnham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to