Open dopry opened 2 years ago
It looks like the get_paginated_object list for DRFChooserMixin should be updated to include the proper params for PageNumberPagination as well as LimitOffsetPagination. The records in the response are normally in the 'results' property not 'items'. Here is what worked for me.
def get_paginated_object_list(self, page_number, **kwargs):
params = self.get_api_parameters(**kwargs)
# support PageNumberPagination
params['page'] = page_number
params['page_size'] = self.per_page
# support LimitOffsetPagination
params['limit'] = self.per_page
params['offset'] = (page_number - 1) * self.per_page
result = requests.get(self.api_base_url, params=params).json()
paginator = APIPaginator(result['count'], self.per_page)
page = Page(result['results'], page_number, paginator)
return (page, paginator)
meta
isn't a standard key in any of the base DRF responses. If this is meant to be the total count of objects in a paginated response it should use thecount
key, not[meta][total_count]
see: https://www.django-rest-framework.org/api-guide/pagination/