title: Filter across three tables using Django
body: <p>I have 3 django models, where the first has a foreign key to the second, and the second has a foreign key to the third. Like this:</p>
  
  <pre><code>
  class Book(models.Model):
      year_published = models.IntField()
      author = models.ForeignKey(Author)
  
  class Author(models.Model):
      author_id = models.AutoField(primary_key=True)
      name = models.CharField(max_length=50)
      agent = models.ForeignKey(LitAgent)
  
  class LitAgent(models.Model):
      agent_id = models.AutoField(primary_key=True)
      name = models.CharField(max_length=50)
  
  </code></pre>
  
  <p>I want to ask for all the literary agents whose authors had books published in 2006, for example. How can I do this in Django? I have looked at the documentation about filters and QuerySets, and don't see an obvious way. Thanks.</p>