17.7 Adding Behavior with GCBV

The central advantage of GCBVs is not replacing views: it’s how quickly they allow developers to add behavior to the website (if the GCBV meets the requirements for the desired behavior).

In the next section, we add views to our blog app to enhance navigation. Our blog post list is helpful for showing the latest views, but it’s not particularly helpful for finding a Post according to date. The de facto way to handle this is to present date archive pages (rather than, say, pagination). These pages show all of the posts in a year or in a month (of a year).

We will thus build two new views: PostArchiveYear and PostArchiveMonth. At the end, we will also replace our PostList view to better adhere to the standards set ...

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.