[Django]-Display item numbers with django paginator.

7👍

If you use generic django views with pagination, you have page_obj, and following will do the trick:

{% for object in object_list %}
   {{forloop.counter|add:page_obj.start_index }} 
{% endfor %}

Moreover, if starting from index 1 is critical, try this instead:

{% for object in object_list %}
   {{forloop.counter0|add:page_obj.start_index }} 
{% endfor %}
👤alko

Leave a comment