From the course: Building Angular and Django Apps

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Pagination with Django

Pagination with Django

From the course: Building Angular and Django Apps

Start my 1-month free trial

Pagination with Django

- [Instructor] On the front end we have the full list of tour packages showing up. However, with Django rest_framework, we can add some pagination to reduce load on the server and the database and to show a smaller amount of packages at a time. So we import PageNumberPagination and then we create a sub class PackagePagination, which is a subclass of PageNumberPagination, and then all we have to do is set the size which will be 10. So 10 packages will be returned from the API, and we just have to update the view set in order to make that happen. So we set the class to PackagePagination class and that's it.

Contents