title: select in (select ..) using ORM django
body: <p>How can I make a query </p>
  
  <pre><code>select  name where id in (select id from ...)
  </code></pre>
  
  <p>using Django ORM? I think I can make this using some loop for for obtain some result  and another loop for, for use this result, but I think that is not practical job, is more simple make a query sql, I think that make this in python should be  more simple in python</p>
  
  <p>I have these models:</p>
  
  <pre><code>class Invoice (models.Model):
      factura_id = models.IntegerField(unique=True)       
      created_date = models.DateTimeField()
      store_id = models.ForeignKey(Store,blank=False)
  
  class invoicePayments(models.Model):
      invoice = models.ForeignKey(Factura)
      date =  models.DateTimeField()#auto_now = True)
      money = models.DecimalField(max_digits=9,decimal_places=0)
  </code></pre>
  
  <p>I need get the  payments of a invoice filter by store_id,date of pay. 
  I make this query in mysql using a <code>select in (select ...)</code>. This a simple query but make some similar using django orm  i only think and make some loop for but I don't like this idea:</p>
  
  <pre><code>invoiceXstore = invoice.objects.filter(local=3)
  
  for a in invoiceXstore:
      payments = invoicePayments.objects.filter(invoice=a.id,
                                                date__range=["2016-05-01", "2016-05-06"])
  </code></pre>