Take max_limit into account when no limit parameter is present in the request with LimitOffsetPagination class.
If max_limit is less than default limit then max_limit will be returned.
This commit is contained in:
Taranjeet Singh 2021-04-21 20:54:13 +05:30
parent 8812394ed8
commit eea623e0d2

View File

@ -439,7 +439,13 @@ class LimitOffsetPagination(BasePagination):
except (KeyError, ValueError):
pass
return self.default_limit
return self.get_lower_of_max_or_default_limit()
def get_lower_of_max_or_default_limit(self):
try:
return min(self.max_limit, self.default_limit)
except TypeError:
return self.default_limit
def get_offset(self, request):
try: