title: Optimizing Django Many-To-Many Query with custom through table
body: <p>I have 2 models:</p>
  
  <pre><code>class ModelA:
      fieldA = models.ManyToManyField(ModelB, through="CustomThroughTable")
  
      def foobar(self):
        return self.fieldA.through.objects.filter(fieldA=self)
  
  class ModelB:
      whatever = models.CharField()
  </code></pre>
  
  <p>I want to implement a function in <code>ModelA</code> that would print out all the values of <code>fieldA</code> in the through table. The current implementation of the function <code>foobar</code> does what I need right now, but I figure it's rather inefficient. Is there a better way to do this? Thanks.</p>