I have the following for loop that iterates over my pagination object:
{% for x in my_paginator.paginator.page_range %}
<a href="?{% if query %}q={{ query }}&{% endif %}page={{ x }}"><u>{{ x }}</u></a>
{% endfor %}
I want to slice out 4 indices less than the current page and 4 values greater than the current page.
I can get current page like this: {{ my_paginator.number }}
How do i get a range that I can print with {{ x }}
if the page number is "61" that outputs something like:
57 58 59 60 61 62 63 64 65
you can render the min and max limits from your views:
then in template like:
then you will have something like:
57 58 59 60 61 62 63 64 65