mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 04:54:00 +03:00
Do not do SELECT count(*) FROM ...
if pagination is not requested (#6098)
* Do not do `SELECT count(*) FROM ...` if pagination is not requested * Update pagination.py Co-authored-by: Tom Christie <tom@tomchristie.com>
This commit is contained in:
parent
750bad0a58
commit
a3ae8ea77e
|
@ -376,11 +376,11 @@ class LimitOffsetPagination(BasePagination):
|
||||||
template = 'rest_framework/pagination/numbers.html'
|
template = 'rest_framework/pagination/numbers.html'
|
||||||
|
|
||||||
def paginate_queryset(self, queryset, request, view=None):
|
def paginate_queryset(self, queryset, request, view=None):
|
||||||
self.count = self.get_count(queryset)
|
|
||||||
self.limit = self.get_limit(request)
|
self.limit = self.get_limit(request)
|
||||||
if self.limit is None:
|
if self.limit is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
self.count = self.get_count(queryset)
|
||||||
self.offset = self.get_offset(request)
|
self.offset = self.get_offset(request)
|
||||||
self.request = request
|
self.request = request
|
||||||
if self.count > self.limit and self.template is not None:
|
if self.count > self.limit and self.template is not None:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user