The PageNumberPagination class is a Django REST framework class for paginating lists of serialized models. In this video, learn how to use PageNumberPagination to paginate a larger set of items and results.
- [Instructor] Sometimes we may have a lot of results … to return from the query set in our API response. … Django REST framework provides three ways … to paginate results: by PageNumber, by Limit OffSet, … and by Cursor. … The PageNumber pagination defaults … to using Django's built-in paginator class … and let's API consumers pass in a page number … to get a page of results. … The LimitOffset pagination is more nuanced … and let's API consumers pass in two query parameters. … The Limit which controls how many items appear on a page … and the OffSet which controls which page appears. … The Cursor pagination uses the database cursor … for paginating results. … The key reason to use this is … when you have very large datasets … and using the other paginator types … would be to inefficient. … Now let's add pagination to our product list API view. … From REST framework, we import the pagination type … we're going to use which is Limit OffSet pagination. … And we create our own … new pagination subclass ProductsPagination. …
- Creating a serializer
- Working with API views
- Filtering back ends
- Enabling pagination
- Executing CRUD operations
- Managing serializer fields
- Testing API views
Skill Level Intermediate
Deploying Django Apps: Make Your Site Go Livewith Nick Walter2h 43m Intermediate
Demo project overview1m 19s
1. Serializing, Listing, Filtering, and Paginating Models
2. Create, Retrieve, Update, and Delete (CRUD) Operations for Models
3. Managing Serializer Fields, Relations, and Validation
4. Testing API Views
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.