Now throws a 404 if page isn't an int

This commit is contained in:
Tom Drummond 2011-07-19 17:54:37 +01:00
parent 1eb2dfcc3a
commit ae059c78da

View File

@ -713,7 +713,7 @@ class PaginatorMixin(object):
try:
page_num = int(self.request.GET.get('page', '1'))
except ValueError:
page_num = 1
raise ErrorResponse(status.HTTP_404_NOT_FOUND, {'detail': 'That page contains no results'})
if page_num not in paginator.page_range:
raise ErrorResponse(status.HTTP_404_NOT_FOUND, {'detail': 'That page contains no results'})