[Django]-What is the django template tag to get the number of items returned in a result set?

81👍

You can use the template filter length:

{{ articles|length }}

will display the length of articles list.

👤manji

11👍

The best way to do this I think is:

{{ articles.count }}

3👍

The count() method gets the number of items retrieved by the queryset it is called on.

Leave a comment