January 2018
Intermediate to advanced
326 pages
7h 38m
English
We enabled pagination to limit the size for the result sets. However, any client or user is able to specify a large number for the limit value, such as 10000, and generate a huge result set. In order to specify the maximum number that is accepted for the limit query parameter, it is necessary to create a customized version of the limit/offset pagination scheme that the Django REST framework provides us.
We made changes to the global configuration to use the rest_framework.pagination.LimitOffsetPagination class to handle paginated responses. This class declares a max_limit class attribute whose default value is equal to None, which means there is no upper bound for the limit value. We will indicate ...