title: Django queryset get max id's for a filter
body: <p>I want to get a list of max ids for a filter I have in Django</p>
  
  <pre><code>class Foo(models.Model):
     name = models.CharField()
     poo = models.CharField() 
  
  Foo.objects.filter(name__in=['foo','koo','too']).latest_by_id()
  </code></pre>
  
  <p>End result a queryset having only the latest <strong>objects</strong> by id for each name. How can I do that in Django?</p>
  
  <p>Edit: I want multiple objects in the end result. Not just one object. </p>
  
  <p>Edit1: Added __in. Once again I need only latest( as a result distinct) objects for each name. </p>
  
  <p>Something like this. </p>
  
  <pre><code>my_id_list = [Foo.objects.filter(name=name).latest('id').id for name in ['foo','koo','too']]
  Foo.objects.filter(id__in=my_id_list)
  </code></pre>
  
  <p>The above works. But I want a more concise way of doing it. Is it possible to do this in a single query/filter annotate combination?</p>