- return HttpResponse(self.index_template.django_template.render(RequestContext(request, {'blog': self.blog, 'entries': entries})), mimetype=self.index_template.mimetype)
+ if self.index_pages != 0:
+ paginator = Paginator(entries, self.index_pages)
+ try:
+ page = int(request.GET.get('page', '1'))
+ entries = paginator.page(page).object_list
+ page_number = paginator.page(page)
+ except ValueError:
+ page = 1
+ entries = paginator.page(page).object_list
+ page_number = paginator.page(page)
+ try:
+ entries = paginator.page(page).object_list
+ page_number = paginator.page(page)
+ except (EmptyPage, InvalidPage):
+ entries = paginator.page(paginator.num_pages).object_list
+ page_number = paginator.page(page)
+ return HttpResponse(self.index_template.django_template.render(RequestContext(request, {'blog': self.blog, 'entries': entries, 'page_number': page_number})), mimetype=self.index_template.mimetype)