- paginator = ObjectPaginator(entries, paginate_by)
- page = int(request.GET.get('page', 0))
- if page > 0:
- page = page - 1
- paginated_entries = paginator.get_page(page)
- pages = [i for i in range(1, paginator.pages + 1)]
+ paginator = Paginator(entries, paginate_by)
+ try:
+ page = int(request.GET.get('page', 1))
+ except ValueError:
+ page = 1
+ paginated_entries = paginator.page(page)
+ pages = paginator.page_range