With a basic understanding of the
Paginator class, we can turn to our startup list webpage and paginate our list. The goal is to allow pagination via the query part of the URL, resulting in
http://site.django-unleashed.com/startup/?page=2, for example.
Before we can jump directly into using
Page, I am going to opt to switch the
Startup list page from a function view into a class-based view (CBV). While this is by no means necessary, it will make my life easier in the long run.
We start by replacing the function view with the class shown in Example 14.19.
95 class StartupList(View): 96 template_name ...