How to return number of rows in the template
- by xRobot
In my view I return all posts of one blog:
posts = Post.objects.filter(blog=blog)
and pass it to context.
But.. How can I get the number of posts in the template ?
This is my template:
<h1>Number of posts: {{ ??? }} </h1>
{% for post in posts %}
{{ post.title }}
{{ post.body }}
{% endfor %}