18.4.2 TagList Pagination

At the end of Chapter 14, we had two CBVs for listing Tag objects. TagList listed all of the tags in the database on a single page. TagPageList paginated the list of tags, using the URL path segment to do so. I’m not a fan of using the URL path to paginate, and so we remove TagPageList and paginate TagList according to the URL query. With our PageLinksMixin, this is quite simple, as you can see in Example 18.12.

Example 18.12: Project Code

organizer/views.py in 81321265be

71   class TagList(PageLinksMixin, ListView): 72       paginate_by = 5 73       model = Tag

The rest of TagList has been removed, and the entirety of TagPageList is gone. Best practice is to remove the organizer_tag_page ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.