Clone wiki

django-simplepagination / Home

Reverse pagination for django-simplepagination

In the output you will see standart digg like (or another) pagination/ example: << Previous 1 2 3 4 5 6 7 8 Next >>

but page numbers in the links will be reverse ordered, example: << Previous 8 7 6 5 4 3 2 1 Next >>

Example of usege same as the basic django-simplepagination. You can add reverse=True to set reversed page order

from simplepagination import paginate
from annoying.decorators import render_to
from blog.models import Post

@paginate(style='digg', per_page=15, reverse=True)
def list_posts(request):
   posts = Post.objects.all()
   return {'object_list': posts}


Parameter double_first means that if it True on the first page will be shown items from per_page to per_page*2. If it False then range will be from 0 to per_page. Setting double_first=True is useful to fill first page.