title: Django query: get the last entries of all distinct values by list
body: <p>I am trying to make a Django query for getting a list of the last entries for each distinct values from a <code>MySQL</code> database. I will show an example below as this explanation can be very complicated. Getting the distinct values by themselves obviously in Django is no problem using <code>.values()</code>. I was thinking to create couple of Django queries but that looks to be cumbersome. Is there an easy way of doing this.</p>
  
  <p>For the example below. Suppose I want the rows with distinct Names with their last entry(latest date). </p>
  
  <pre><code>Name            email                 date
  _________________________________________________
  
  Dane            dane@yahoo.com        2017-06-20
  Kim             kim@gmail.com         2017-06-10
  Hong            hong@gmail.com        2016-06-25
  Dane            dddd@gmail.com        2017-06-04
  Susan           Susan@gmail.com       2017-05-21
  Dane            kkkk@gmail.com        2017-02-01
  Susan           sss@gmail.com         2017-05-20
  </code></pre>
  
  <p>All the distinct values are Dane, kim, Hong, Susan. I also want the rows with the latest dates associated with these distinct name. The list with entries I would like is the rows below. Notice Names are all distinct, and they are associated with the latest date.</p>
  
  <pre><code> Name            email                 date
  _________________________________________________
  
  Dane            dane@yahoo.com        2017-06-20
  Kim             kim@gmail.com         2017-06-10
  Hong            hong@gmail.com        2016-06-25
  Susan           Susan@gmail.com       2017-05-21
  </code></pre>