- paginated_entries = paginator.page(page)
- pages = paginator.page_range
- t = loader.get_template("blog/blog_index.html")
- c = RequestContext(request,
- {
- "entries": paginated_entries.object_list,
- "title": settings.BLOG_TITLE,
- "page": page,
- "pages": pages,
- "paginated": 1,
- "has_more_than_one_page": (len(pages) > 1),
- "has_next": paginated_entries.has_next(),
- "has_prev": paginated_entries.has_previous(),
- "next": page + 1,
- "prev": page - 1
- })
- return HttpResponse(t.render(c))
+ try:
+ paginated_entries = paginator.page(page)
+ pages = paginator.page_range
+ t = loader.get_template("blog/blog_index.html")
+ c = RequestContext(request,
+ {
+ "entries": paginated_entries.object_list,
+ "title": settings.BLOG_TITLE,
+ "page": page,
+ "pages": pages,
+ "paginated": 1,
+ "has_more_than_one_page": (len(pages) > 1),
+ "has_next": paginated_entries.has_next(),
+ "has_prev": paginated_entries.has_previous(),
+ "next": page + 1,
+ "prev": page - 1
+ })
+ return HttpResponse(t.render(c))
+ except:
+ raise Http404
- paginated_entries = paginator.page(page)
- pages = paginator.page_range
- t = loader.get_template("blog/blog_index.html")
- c = RequestContext(request,
- {
- "entries": paginated_entries.object_list,
- "title": settings.BLOG_TITLE,
- "page": page,
- "pages": pages,
- "paginated": 1,
- "has_more_than_one_page": (len(pages) > 1),
- "has_next": paginated_entries.has_next(),
- "has_prev": paginated_entries.has_previous(),
- "next": page + 1,
- "prev": page - 1
- })
- return HttpResponse(t.render(c))
+ try:
+ paginated_entries = paginator.page(page)
+ pages = paginator.page_range
+ t = loader.get_template("blog/blog_index.html")
+ c = RequestContext(request,
+ {
+ "entries": paginated_entries.object_list,
+ "title": settings.BLOG_TITLE,
+ "page": page,
+ "pages": pages,
+ "paginated": 1,
+ "has_more_than_one_page": (len(pages) > 1),
+ "has_next": paginated_entries.has_next(),
+ "has_prev": paginated_entries.has_previous(),
+ "next": page + 1,
+ "prev": page - 1
+ })
+ return HttpResponse(t.render(c))
+ except:
+ raise Http404