Django-pagination: Accessing the page object after using {% autopaginate list %}
I'm using django-pagination to paginate lists for my Django site. At the top of my template, I'm using
{% autopaginate projects 10 %}
I want to display something like 'Showing 1 - 10 of 52 results'. I know it's easiest to do this with the page objects created by the template tag. The problem is that I don't know how to access it in the template context.
I tried to look through the source, and it looks like the tag loads it into 'page_obj' as you can see here, but I couldn't get it to work.
Showin开发者_Go百科g <span>{{ page_obj.start_index }}</span> - <span>{{ page_obj.end_index }}</span> of <span>{{ projects.count }}</span> results
only displays: Showing - of 5 results
check out this
just put:
{% paginate %}
on the template after the {% autopaginate projects 10 %} tag.
精彩评论