November 2015
Beginner to intermediate
840 pages
26h 30m
English
In Chapter 14: Pagination, we saw that while Django can handle pagination in many ways, it does not build the links for pagination for us. GCBVs follow the same pattern. Given that both TagList and StartupList will use the same kind of pagination, we can extend the pagination behavior of ListView to build the links for our templates.
In organizer/utils.py, we can create a PageLinksMixin class to add the behavior we want, as shown in Example 18.5.
Example 18.5: Project Code
organizer/utils.py in be588e9505
1 class PageLinksMixin: 2 page_kwarg = 'page'
The basis of all our links is to have a query URL segment with the page variable equal to the number of the page, as shown in Example 18.6.
Example 18.6: ...
Read now
Unlock full access