title: Django filter through multiple fields in a many-to-many intermediary table
body: <p>I have the following models in my django project:</p>
  
  <pre><code>class Video(models.Model):
      media = models.ForeignKey(Media)
  
  class Media(models.Model):
      title = models.CharField(max_length=255)
      formats = models.ManyToManyField(Format,through='MediaFormat',related_name='media',blank=True)
  
  class Format(models.Model):
      title = models.CharField(max_length=50)
  
  class MediaFormat(models.Model):
      status = models.IntegerField()
      format = models.ForeignKey(Format)
      media = models.ForeignKey(Media)
  </code></pre>
  
  <p>Now, I want to filter all videos which have a specific format, AND the status code for that format is 10 (ready to use). How can I do that?
  (assuming that f is the format):</p>
  
  <pre><code>f = Format.objects.get(pk=3)
  </code></pre>
  
  <p>I'm tempted to use:</p>
  
  <pre><code>Video.objects.filter(media__formats=f, media__mediaformat__status=10)
  </code></pre>
  
  <p>But then, that would return all videos that matches both of these assumptions:</p>
  
  <ul>
  <li>a) contain that specific format, and</li>
  <li>b) contain any format with the status of 10</li>
  </ul>
  
  <p>How am I supposed to filter only those who have that specific format in a status code of 10?</p>
  
  <p>thank you!</p>