Quantcast
Channel: Latest posts from timonweb.com
Viewing all articles
Browse latest Browse all 93

How To Show Correct List Item Indexes When Using Pagination in Django

$
0
0

In your Django template put something like this:

  1. <ul>
  2. {% for object in object_list %}
  3. <li>{{ forloop.counter0|add:page_obj.start_index }}. {{ object }}</li>
  4. {% endfor %}
  5. </ul>

Where:

object_list - is a list of objects produced by pagination;

page_obj - is a page object produced by pagination

page_obj ...

Read now


Viewing all articles
Browse latest Browse all 93

Trending Articles