On Sun, 2009-02-22 at 22:56 +0700, Reza Muhammad wrote: [...] > > Doesn't work either. This one returns no results, just like chaining > > filters. > > > I think the above was just a clue, if you need "OR" condition instead > of "AND", you need to use "|" not "&" so: > > Project.objects.filter(Q(persons=persons_a) | Q(persons=persons_b))
If this is the case, then the original problem description was incorrect. Mikkel: you said you wanted projects containing person_a *and* person_b, which is what the chaining filters and Q() & Q() version is giving you. If they're returning no results, it's because no results exist. The above filter -- Q() | Q() -- is going to return projects that contain person_a *or* person_b. Is that what you're after? 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 django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---