November 2015
Beginner to intermediate
840 pages
26h 30m
English
StartupList PaginationWe can now use our PageLinksMixin in tandem with ListView to replace the code for StartupList. We therefore change the inheritance to use multiple inheritance of both PageLinksMixin and ListView, and we keep the model and paginate_by attributes, as shown in Example 18.10. The rest can be deleted.
Example 18.10: Project Code
organizer/views.py in 81321265be
2 from django.views.generic import ( 3 CreateView, DeleteView, DetailView, ListView) . ... 10 from .utils import PageLinksMixin . ... 46 class StartupList(PageLinksMixin, ListView): 47 model = Startup 48 paginate_by = 5
There’s a bit of a gotcha here. In our case, we had been passing the
Read now
Unlock full access