Re: Filtering on Many2Many Related Objects

2011-05-29 Thread Daniel Watkins
On Sun, May 22, 2011 at 05:42:00PM -0700, Chris Beaven wrote: > Isn't the first suggestion (__contains) achievable already by just chaining > two filters: Group.objects.filter(persons=p1).filter(persons=p2) ? Sure, but if I want to filter on several different numbers of persons, it gets very

Re: Filtering on Many2Many Related Objects

2011-05-22 Thread Chris Beaven
Isn't the first suggestion (__contains) achievable already by just chaining two filters: Group.objects.filter(persons=p1).filter(persons=p2) ? -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to

Filtering on Many2Many Related Objects

2011-05-20 Thread Daniel Watkins
Hello all, Earlier I was trying to filter for objects that had a set of other objects related to them by a ManyToManyField. It's a bit awkward, and I have a couple of proposals to improve it. Consider the following models: class Person(models.Model): name =