This is an example from the Django documentation:
def listing(request): contact_list = Contacts.objects.all() paginator = Paginator(contact_list, 25)
template:
{% for contact in contacts %} {# Each "contact" is a Contact model object. #} {{ contact.full_name|upper }}<br /> ... {% endfor %} <div class="pagination"> <span class="step-links"> {% if contacts.has_previous %} <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>
This screen, for example:
Page 2 of 3. next
How to display it as follows:
previous 1 <b>2</b> 3 Next
Current page tagged html <b> .
?
source share