19 lines
469 B
Python
19 lines
469 B
Python
"""
|
|
Custom pagination class for DRF to support dynamic page_size query parameter
|
|
"""
|
|
from rest_framework.pagination import PageNumberPagination
|
|
|
|
|
|
class CustomPageNumberPagination(PageNumberPagination):
|
|
"""
|
|
Custom pagination class that allows clients to override the page size
|
|
via the page_size query parameter.
|
|
|
|
Default page size: 10
|
|
Max page size: 100
|
|
"""
|
|
page_size = 10
|
|
page_size_query_param = 'page_size'
|
|
max_page_size = 100
|
|
|