﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
28032	Add Paginator.get_page() to abstract away pagination boilerplate handling of invalid pages	Ian Foote	Sami J. Lehtinen	"In the [https://docs.djangoproject.com/en/1.11/topics/pagination/#using-paginator-in-a-view documentation for pagination], we recommend using this boilerplate:


{{{
try:
    contacts = paginator.page(page)
except PageNotAnInteger:
    # If page is not an integer, deliver first page.
    contacts = paginator.page(1)
except EmptyPage:
    # If page is out of range (e.g. 9999), deliver last page of results.
    contacts = paginator.page(paginator.num_pages)
}}}

This could be abstracted away into a simple method on the [https://github.com/django/django/blob/5a6f70b4281817656db2f36c5919036d38fcce7f/django/core/paginator.py#L25 Paginator] class, perhaps named something like {{{results_for_page}}}."	Cleanup/optimization	closed	Core (Other)	dev	Normal	fixed	Pagination Paginator		Ready for checkin	1	0	0	0	1	0
