title: Get distinct django objects from queryset sorted by latest
body: <p>I have this model (irrelevant fields hidden):</p>
  
  <pre><code>class Blog(models.Model):
      author = models.ForeignKey(Author, on_delete=models.CASCADE)
      is_published = models.BooleanField(default=False)
      published_date = models.DateTimeField(null=True, default=None, blank=True)
  </code></pre>
  
  <p>I only want to get the latest post of each author, sorted by published date.</p>
  
  <p>I have tried the following in my view:</p>
  
  <pre><code>blog_list = Blog.objects.filter(is_published=True).order_by('author', '-published_date').distinct('author')
  </code></pre>
  
  <p>Which works <em>except</em> this sorts all of the blog post in order of the author, not by published date.</p>
  
  <p>The following would actually do the trick by switching the order by, but this throws an error in django:</p>
  
  <pre><code>blog_list = Blog.objects.filter(is_published=True).order_by('-published_date', 'author').distinct('author')
  </code></pre>
  
  <p>I've checked all of the similar questions to this one and haven't encountered a solution that works. I think this request should be pretty simple but I don't see any way of achieving this.</p>