The ObjectPaginator is cool.  I just can't seem to find any
documentation on how to properly implement it in a project.

This is what I did... hopefully it'll be of use to some.  If someone
has a cleaner method of implementing this object

##someView.py
paginate_by = 20

paginator = ObjectPaginator(leads, {"id__gt":1}, paginate_by)
page = int(request.GET.get('page',0))
object_list = paginator.get_page(page)

return render_to_response('templateName', {"'object_list': object_list,
'is_paginated': paginator.pages > 1, 'results_per_page': paginate_by,
'has_next': paginator.has_next_page(page), 'has_previous':
paginator.has_previous_page(page), 'page': page + 1, 'next': page + 1,
'previous': page - 1, 'pages': paginator.pages, 'hits' :
paginator.hits, } )

Reply via email to