title: Django double join via multiple models
body: <h2>Situation</h2>
  
  <p>I have 3 models. Model A, model B and model C.</p>
  
  <pre><code>class A(Model):
      B_id = ForeignKey(B)
      id = IntegerField()
      pub_date = DateField()
  
  class B(Model):
      id = IntegerField(primary_key = True)
  
  class C(Model):
      B_id = ForeignKey(B)
      pub_date = DateField()
      information = TextField()
  </code></pre>
  
  <p>Model A and model C both have a field called <code>B_id</code>, which is a foreign key to model B. So there is no direct connection from B to A or C.</p>
  
  <h2>Goal</h2>
  
  <p>I'm given an ID from model A. Now I need all informations from C where the pub_date matches the pub_date in A and the B_id matches the B_id in A.</p>
  
  <p>In SQL, this would be a pretty easy query:</p>
  
  <pre><code>SELECT C.information FROM A JOIN C USING(B_id, pub_date) WHERE A.id = 1234;
  </code></pre>
  
  <p>But I simply can't figure out how to do this in Django ORM syntax, as a <code>filter()</code>-clause only works if there is a direct connection path from C to A.</p>
  
  <p>--</p>
  
  <p>Edit: Please note that there is more than one row in A that matches one id.</p>