1👍
✅
The easiest way would be to add a method to count comments to your Post
model:
class Post(models.Model):
...
def comments_count(self):
return Comment.objects.filter(post=self).count()
then use it in your template such as:
{% for post in posts %}
{{ post.title }}: {{ post.comments_count }}
{% endfor %}
Source:stackexchange.com