django-rest-framework [Introductory] Setup Pagination Style Globally


In order to set the pagination style for the entire project, you need to set the DEFAULT_PAGINATION_CLASS and PAGE_SIZE on the project settings.

To do so, go to and on the REST_FRAMEWORK variable, add the following:

    'PAGE_SIZE': 100

In place of the DESIRED_PAGINATION_STYLE one of the following must be placed:

  • PageNumberPagination: Accepts a single page number in the request query parameters.

  • LimitOffsetPagination: Accepts a limit parameter, which indicates the maximum number of items that will be returned and an offset parameter which indicates the starting position of the query in relation to the dataset. PAGE_SIZE does not need to be set for this style.

  • CursorPagination: Cursor based pagination is more complex than the above styles. It requires that the dataset presents a fixed ordering, and does not allow the client to navigate into arbitrarily positions of the dataset.

  • Custom pagination styles can be defined in place of the above.