title: Get latest post for category
body: <p>I'm trying to get the latest post for each of the category in my forum app. I've been trying things like <code>Category.objects.order_by('catID').annotate(latestpost=Post.objects.order_by('-pub_date')[:1])</code>
  I want to be able to do use the values: <code>postID</code>, <code>title</code>, <code>user</code> and <code>pub_date</code> in my template.</p>
  
  <p>models.py:</p>
  
  <pre><code>class Category(models.Model):
      catID = models.CharField(max_length=20, primary_key=True)
      title = models.CharField(max_length=200)
      description = models.CharField(max_length=200)
  
  class Post(models.Model):
      postID = models.CharField(max_length=10, primary_key=True)
      catID = models.ForeignKey(Category)
      user = models.CharField(max_length=100)
      title = models.CharField(max_length=200)
      content = models.TextField()
      pub_date = models.DateTimeField(auto_now=True)
  </code></pre>
  
  <p>views.py:</p>
  
  <pre><code>def index(request):
      cats = Category.objects.order_by('catID').annotate(latestpost=Post.objects.order_by('-pub_date')[:1])
      context = {'forum_cats': cats}
      return render(request, 'forums/index.html', context)
  </code></pre>