mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-26 11:33:59 +03:00
added support for passing page_size per request
This commit is contained in:
parent
44e9749e36
commit
023b065ddc
|
@ -55,6 +55,16 @@ class ListModelMixin(object):
|
|||
|
||||
return Response(serializer.data)
|
||||
|
||||
def get_paginate_by(self, queryset):
|
||||
page_size_param = self.request.QUERY_PARAMS.get('page_size')
|
||||
if page_size_param:
|
||||
try:
|
||||
page_size = int(page_size_param)
|
||||
return page_size
|
||||
except ValueError:
|
||||
pass
|
||||
return super(ListModelMixin, self).get_paginate_by(queryset)
|
||||
|
||||
|
||||
class RetrieveModelMixin(object):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user