title: How to query ManyToMany through relationship with some property in django?
body: <pre><code>class Person(models.Model):
      age = models.IntegerField()
  
  class Group(models.Model):
      people = models.ManyToManyField(Person,through=Membership)
  
  class Membership(models.Model):
      person = models.ForeignKey(Person)
      group = models.ForeignKey(Group)
      existing = models.BooleanField()
  </code></pre>
  
  <p>This is the simplified class structure and what I want to query is:
  A queryset on group such that there are some people with membership such that <code>existing</code> is true.
  I have tried using <code>Group.objects.filter(membership__existing=True)</code> but it seems to be grabbing all the Groups.</p>
  
  <p>What is the most efficient way to filter out the queryset?</p>