0

I have a model called DemoModel and contains 1000 records in DB. So i am paginating using paginator in Django(assume that per page 15 records, so i have 67 pages). So i want to get the records of 3,4 and 5 pages and i have to append the records into list.

So can i get the objects_list based on page range or anything else i want to do?

Example:

records.page(1)

Here i am getting only one page records at a time, but how can i get multiple page records i.e; from fist page to third page

praveen jp
  • 197
  • 2
  • 14

1 Answers1

0

Assuming you are asking about the API request to get the paginated resources, and you are using the default pagination class: rest_framework.pagination.LimitOffsetPagination, then you can make an request as such:

https://api.example.org/accounts/?limit=30&offset=15

which in turns give you the 2nd and 3rd "page". The limit indicates the maximum number of items to return, and is equivalent to the page_size in other styles. The offset indicates the starting position of the query in relation to the complete set of unpaginated items. doc link