Django pagination - with unlimited queries
I am using Django pagination - and it works great ;) ...
But in some cases I have a URL with queryies - and when i use the default template setup for pagination - it wont work..
<div class="pagination">
<span class="step-links">
{% if contacts.has_previous 开发者_如何学Python%}
<a href="?page={{ contacts.previous_page_number }}">previous</a>
{% endif %}
<span class="current">
Page {{ contacts.number }} of {{ contacts.paginator.num_pages }}.
</span>
{% if contacts.has_next %}
<a href="?page={{ contacts.next_page_number }}">next</a>
{% endif %}
</span>
</div>
How can I do it ? ..
My url can look like this: http://www.example.com/tag/?tag=fewa&met=23&g=2&page=2 or http://www.example.com/tag/?tag=fewa&g=2&t=ewq&page=2
What can I do at the pre and next position?
<a href="?page={{ products.previous_page_number }}{% for key,value in request.GET.items %}{% ifnotequal key 'page' %}&{{ key }}={{ value }}{% endifnotequal %}{% endfor %}">forrige</a>
I got IT ;)
精彩评论