2
You don’t need to do maths for this. The page
object already gives you the relevant information: start_index
and end_index
.
So:
{% with table.page as page %}
Showing {{ page.start_index }} - {{ page.end_index }} of {{ page.paginator.count }}
{% endwith %}
Plus, you can use page.has_other_pages
to determine if there are other pages, rather than your complex logic comparing the total with the current count.
See the pagination docs.
Source:stackexchange.com