Haikal Nashuha
Haikal Nashuha

Reputation: 3048

Django Row Number in Pagination

Is there a way in getting the row number for items displayed in Paginator? For example, i set that a page should contain 50 items so, the next page row number should start at 51. However I cannot find any way to do this, and when I use forloop.counter the row number resets every page.

Upvotes: 3

Views: 3199

Answers (1)

Timmy O'Mahony
Timmy O'Mahony

Reputation: 53981

You can use the add template tag to add the current count from the paginator to the forloop

{{ forloop.counter.0|add:paginator.page.start_index }}

Upvotes: 11

Related Questions