title: Count method in Django template not working as expected
body: <p>I'm building a news app that allows members to post comments on articles. I want to display the articles in my template and also display the number of comments that have been made on each article. I tried using the count method but, it retrieved the total number of comments in my comments table instead of the number of comments that a particular article has.</p>
  
  <pre><code>#models.py
  class Article(models.Model):
      #auto-generate indices for our options
      ENTRY_STATUS = enumerate(('no', 'yes'))
      #this will be a foreign key once account app is built
      author = models.CharField(default=1, max_length=1)
      category = models.ForeignKey(Category)
      title = models.CharField(max_length=50)
      entry = models.TextField()
      dateposted = models.DateTimeField(default=timezone.now, auto_now_add=True)
      draft = models.IntegerField(choices=ENTRY_STATUS, default=0)
      lastupdated = models.DateTimeField(default=timezone.now, auto_now=True)
  
      #prevents the generic labeling of our class as 'Classname object'
      def __unicode__(self):
          return self.title
  
  
  class Comment(models.Model):
      #this will be a foreign key once account app is built
      author = models.CharField(default=1, max_length=1)
      article = models.ForeignKey(Article)
      dateposted = models.DateTimeField(auto_now_add=True)
      comment = models.TextField()
  
      def __unicode__(self):
          #returns the dateposted as a unicode string
          return unicode(self.dateposted)
  
  #templates/list_articles.html
  {% for comment in comments %}
      {% if comment.article_id == article.id %}
          {% if comments.count &lt; 2 %}
              #this is returning all comments in comment table
              &lt;b&gt;{{ comments.count }} comment&lt;/b&gt;
          {% else %}
              &lt;b&gt;{{ comments.count }} comments&lt;/b&gt;
          {% endif %}
      {% endif %}
  {% endfor %}
  </code></pre>
  
  <p>All the examples I've seen so far manually provide a value to filter by(e.g. <code>Comment.objects.filter(article_id=x).count()</code> ) In my case I only have access via the template.</p>
  
  <pre><code>#views.py
  class ArticlesListView(ListView):
      context_object_name = 'articles'
      # only display published pieces (limit 5)
      queryset = Article.objects.select_related().order_by('-dateposted').filter(draft=0)[:5]
      template_name = 'news/list_articles.html'
  
      # overide this to pass additional context to templates
      def get_context_data(self, **kwargs):
          context = super(ArticlesListView, self).get_context_data(**kwargs)
          #get all comments
          context['comments'] = Comment.objects.order_by('-dateposted')
          #get all article photos
          context['photos'] = Photo.objects.all()
          #context['total_comments'] = Comment.objects.filter(article_id=Article)
          return context
  </code></pre>
  
  <p>My intended result is to have a listing of all articles and a roll-up of comments made on that article below each article(e.g. Article 1: 4 comments, Article 5: 1 comment, etc...) Right now I'm getting: Article 1: 4 comments, Article 5: 4 comments(even though Article 5 only has 1 comment)</p>
  
  <p>Any help is appreciated. I've spent 5 hours reading through the documentation but every example manually provides a value to filter by.</p>