Skip to Content
Django RESTful Web Services
book

Django RESTful Web Services

by Gastón C. Hillar
January 2018
Intermediate to advanced
326 pages
7h 38m
English
Packt Publishing
Content preview from Django RESTful Web Services

Working with customized pagination classes

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 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Building Versatile Mobile Apps with Python and REST: RESTful Web Services with Django and React

Building Versatile Mobile Apps with Python and REST: RESTful Web Services with Django and React

Art Yudin

Publisher Resources

ISBN: 9781788833929Supplemental Content