If you have dynamically changing lists of objects or the amount of them is greater than 30, you will surely need pagination for the list. With pagination, instead of the full
QuerySet, you provide a fraction of the dataset that is limited to a specific amount per page and you will also show the links to get to the other pages of the list. Django has classes to manage the paginated data, and we will see how to do that in this recipe for the example provided in the previous recipe.
Let's start with the forms and views of the
movies app from the Filtering object lists recipe.
To add pagination to the list view of the movies, follow these steps: