title: Django order_by ForeignKey set models
body: <p>I have following django models</p>
  
  <pre><code>class Post(models.Model):
      title = models.CharField(max_length=240)
  
  class Comment(models.Model):
      post = models.ForeignKey(Post)
      date = models.DateTimeField(auto_now_add=True)
  </code></pre>
  
  <p>I need a QuerySet of comments, ordered first by post, then by date.
  But posts must be ordered by its latest comment.</p>
  
  <p>If i could use model methods in QuerySet order_by, it would be like this:</p>
  
  <pre><code>class Post(models.Model):
      title = models.CharField(max_length=240)
  
      def get_last_comment_date(self):
          return self.comment_set.order_by('-date')[0].date
  </code></pre>
  
  <p>And the ordering, that i needed, could be:</p>
  
  <pre><code>Comment.objects.all().order_by('post__get_last_comment_date', '-date')
  </code></pre>
  
  <p>But unfortunately, methods in order_by are not allowed.</p>
  
  <p>Please, help. Can i have such ordering?</p>