O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.4 Paginating the Startup List Webpage

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required