title: Django order by count
body: <p>I have these models:</p>
  
  <pre><code> class Project(models.Model):
     title=models.CharField(max_length=80)date_created=models.DateTimeField(auto_now_add=True)e)
      category = models.ForeignKey(Category)
  
  class Category(models.Model):
      name = models.CharField(max_length=80)
  </code></pre>
  
  <p>And this in views:</p>
  
  <pre><code>cat_list = Category.objects.order_by(order_by)
  for c in cat_list:
      count = Project.objects.filter(category__id=c.id).count()
      setattr(c, 'count', count)
  </code></pre>
  
  <p>How can I now order this by COUNT attribute?</p>