title: Django DB API equivalent of a somewhat complex SQL query
body: <p>I'm new to Django and still having some problems about simple queries.</p>
  
  <p>Let's assume that I'm writting an email application. This is the Mail
  model:</p>
  
  <pre><code>
  class Mail(models.Model):
      to = models.ForeignKey(User, related_name = "to")
      sender = models.ForeignKey(User, related_name = "sender")
      subject = models.CharField()
      conversation_id = models.IntegerField()
      read = models.BooleanField()
      message = models.TextField()
      sent_time = models.DateTimeField(auto_now_add = True)
  </code></pre>
  
  <p>Each mail has conversation_id which identifies a set of email messages
  which are written and replyed. Now, for listing emails in inbox, I
  would like as gmail to show only last email per conversation.</p>
  
  <p>I have the SQL equivalent which does the job, but how to construct native Django query for this?</p>
  
  <pre><code>
  select
          *
  from
          main_intermail
  where
          id in
          (select
                  max(id)
          from
                  main_intermail
          group by conversation_id); 
  </code></pre>
  
  <p>Thank you in advance!</p>