title: Django get objects not referenced by foreign key
body: <p>I have two models like this:</p>
  
  <pre><code>class AA(models.Model):
      name = models.CharField()
      state = models.IngerField()
  
  
  class BB(models.Model):
      aa_id = models.ForeignKey(AA)
  </code></pre>
  
  <p>My question is:
  How i get all objects AA with state 10 and that are not in BB?</p>
  
  <p>In sql i do something like this:</p>
  
  <pre><code>select * from AA 
  where  AA.state = 10 and AA.id not in (select aa_id from BB)
  </code></pre>
  
  <p>or</p>
  
  <pre><code>select * from AA
  left join BB on BB.aa_id = AA.id
  where AA.state = 10 and BB.id is null
  </code></pre>
  
  <p>I know that i can get all AA objects and check one by one if BB has foreign key to it. But is not the right thing to do.</p>
  
  <p>Thanks.</p>