Do not re-run query for empty results with LimitOffsetPagination (#4388)

This commit is contained in:
Tom Christie 2016-08-11 16:54:55 +01:00 committed by GitHub
parent 1312acaf8b
commit ebf43346a1

View File

@ -312,6 +312,9 @@ class LimitOffsetPagination(BasePagination):
self.request = request
if self.count > self.limit and self.template is not None:
self.display_page_controls = True
if self.count == 0 or self.offset > self.count:
return []
return list(queryset[self.offset:self.offset + self.limit])
def get_paginated_response(self, data):