What is the tag that displays the number of items returned in an object list? For example, in a view called /search/q=my search text here a list of articles 开发者_如何学Pythonare displayed that matches the user's search query. In the template I want to display the number of articles that were returned by the search.
You can use the template filter length:
{{ articles|length }}
will display the length of articles list.
The best way to do this I think is:
{{ articles.count }}
The count() method gets the number of items retrieved by the queryset it is called on.
加载中,请稍侯......
精彩评论