I see there was a similar question on this issue earlier today but alas it didn't answer my question.
In my app I have models for: Project: a project (not really part of this question but used for context in the question). Paper: an academic paper description Review: a review of a paper ... other things not pertinent. I can list Projects and from there I can list Papers assigned to each project. In the listing of papers I want to show how many reviews there are for each Paper. Paper has a ForeignKey to Project and Review has a ForeignKey to Paper. I have this code as my view: class PapersListView(ListView): model = Paper template_name = 'papers/papers_list.html' def get_context_data(self, **kwargs): context = super(PapersListView, self).get_context_data(**kwargs) papers = Paper.objects.filter(project__id=self.kwargs['pk']) review_count = Review.objects.aggregate(review_count=Count('paper')) print(review_count) context['papers'] = papers context['review_count'] = review_count return context and this in my template: <div class="table"> <table class="listing" cellpadding="2" cellspacing="2"> <tr> <th>Title</th> <th>Reviews</th> <th>Year</th> <th>Journal</th> <th>Current Stage</th> </tr> {% for p in papers %} <tr> <td class="style1"><a href="#">{{p.title}}</a></td> <td>{{p.review_count}}</td> <td>{{p.year_published}}</td> <td>{{p.journal}}</td> <td>{{p.current_stage}}</td> </tr> {% endfor %} </table> </div> The print() inserted in the view gives me this: {'review_count': 2} In the rendered template the Reviews column is empty. There are two Review instances in the database. But, they are for two separate Papers in two separate Projects. So, my guess is that I have two problems but after scouring the docs I can't determine where the mistakes/misunderstandings are. Any help is appreciated. Cheers, Tim -- MLHIM VIP Signup: http://goo.gl/22B0U ============================================ Timothy Cook, MSc +55 21 94711995 MLHIM http://www.mlhim.org Like Us on FB: https://www.facebook.com/mlhim2 Circle us on G+: http://goo.gl/44EV5 Google Scholar: http://goo.gl/MMZ1o LinkedIn Profile:http://www.linkedin.com/in/timothywaynecook -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2B%3DOU3U2L%3DxPSxfuFV8RiX6gmnA_qQx7RPrAJhjo6Ee-iRtMPA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.