title: Django: join two tables
body: <p>Here's what I currently have:</p>
  
  <pre><code>class Sessions(models.Model):
      sessionId = models.AutoField(primary_key=True)
  
  class Ip(models.Model):
      ipId = models.AutoField(primary_key=True)
  
  class Affiliation(models.Model):
      affiliationId = models.AutoField(primary_key=True)
      ip = models.ForeignKey("Ip", null=False, db_column="ipId")
      session = models.ForeignKey("Sessions", null=False, db_column="sessionId")
  </code></pre>
  
  <p>Now I want to find the Sessions QuerySet which returns ipId=x. Basically this is what I'm trying:</p>
  
  <pre><code>Sessions.objects.filter(affiliation__ip=x)
  </code></pre>
  
  <p>Is there any way I can do this in django?</p>