Set self.count before self.limit in LimitOffsetPagination by dfavato · Pull Request #4437 · encode/django-rest-framework (original) (raw)
Just a minor change.
Description
By setting self.count before self.limit in the LimitOffsetPagination it is possible, if one wants, to override get_limit in order to return all records if the request has a predefined param.
For example, if one wants that all records are retrieved if url has &limit=-1, in this case, get_limit could return self.count.
Otherwise, if self.count is set after self.limit then, to achieve the same result, one has to override get_limit and paginate_queryset, or run get_limit twice.