Your Ad Here

Wednesday, January 4, 2012

Pagination in ListView

Hi,
I'm using a list view to show a list of my objects.

===================================================
class MyListView(ListView):
model = models.Post
template_name = 'post_list.html'
paginate_by = 10
===================================================

When a visitors goes to a page higher than exists, I'd like it to go
to the last page. (ie: ?page=9999 goes to ?page=5 if there are only 5
pages).
Is 'get_queryset' the right place to do this or am I completely off?

Thank you.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 comments:

Post a Comment