November 2015
Beginner to intermediate
840 pages
26h 30m
English
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 Pagination and 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.
Example 14.19: Project Code
organizer/views.py in f0f3d8de64
95 class StartupList(View): 96 template_name ...
Read now
Unlock full access