I am using django haystack with xapian as the backend search engine. I am using FacetedSearchView
and FacetedSearchForm
for faceting over the search. I have passed searchqueryset
to the FacetSearchView
in my urls.py
file.
But the problem is I cannot access that searchqueryset
in template. All I want to do is count the number of objects in searchqueryset
found.
In shell I could achieve it using S earchQuerySet().filter(content="foo").count()
, how can I do that similarly in the template? Please guide. I want the total number of objects matching the search.
Haystack uses the standard django pagination: https://docs.djangoproject.com/en/dev/topics/pagination/
Showing {{ page.object_list|length }}
of {{ page.paginator.count }}
Results on Page {{ page.number }}
of {{ page.paginator.num_pages }}
如果要显示结果范围而不是页码,例如“结果21-40 of 1001” ,您可以这样做
Results {{ page.start_index }} - {{ page.end_index }} of {{ page.paginator.count }}
{{ page.object_list | length }}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.