title: Django Two Way relationship
body: <p>I am building a blog site and have models in respect of Category and Posts.  Posts have a Many to Many relationship for Category.</p>
  
  <pre><code>class Post(models.Model):
       categories = models.ManyToManyField(Category)
  </code></pre>
  
  <p>Everything is working fine aside from the fact that in the Category list in the template I only want to load categories that actually have posts.</p>
  
  <p>If a category is empty I don't want to display it, I have tried to define a relationship in Category to Post to allow me to use something like <code>{{ if category.posts }}</code>.  At the moment using another Many to Many field in Category is presently giving me an extra field in admin which I don't really want or feel that's needed.</p>
  
  <p>How is best to navigate this relationship, or create one that's suitable?</p>
  
  <p>Cheers
  Kev</p>