Django pagination | get current index of paginated item in page index, (not the page index range its
Posted
by cka
on Stack Overflow
See other posts from Stack Overflow
or by cka
Published on 2010-03-31T00:09:27Z
Indexed on
2010/03/31
0:13 UTC
Read the original article
Hit count: 647
I am trying to build a photo gallery with Django.
It is set up by category.
I have paginated the results of a category by n amount of images per page. I want to also use the paginator on the page that shows just the single image and have a prev/next button for the prev/next image in that category.
My thought was to get the current index for the image itself and have that be the link to the /category/CUR_IMG_ID_PAGINATION_LIST/ as the result of paginating the entire set would yield the same index as the current image index in the paginated results.
For instance if the image i want is image 45 out of 150 images total for a category, then when i paginate the 150 images the 45 will be the actual number of the page I want.
If there's an easier way to do this, let me know. Django 1.1
© Stack Overflow or respective owner