django - show the length of a queryset in a template

django

Solution

Give `{{ some_queryset.count }}` a try.

This is better than using len (which could be invoked with `{{ some_queryset.__len__ }}`) because it optimizes the SQL generated in the background to only retrieve the number of records instead of the records themselves.

Problem

In my html file, how can I output the size of the queryset that I am using (for my debugging purposes) I've tried ``` {{ len(some_queryset) }} ``` but that didn't work. What is the format?

Original source

Related problems