17.7.2 Monthly Archive for Post

Surprisingly, Django’s MonthArchiveView GCBV does not work like YearArchiveView GCBV. The MonthArchiveView GCBV does not recognize make_object_list, assuming instead that developers will want to display objects in this template. However, MonthArchiveView also provides the date_list to the template context, created on the basis of the same date_list_period attribute found in YearArchiveView (the default of which is 'day' in MonthArchiveView).

We won’t be creating a day archive view for our Post model, as we shouldn’t have more than a few blog posts a month. We therefore won’t use the date_list context variable. Our view will list only objects published that month.

17.7.2.1 View and URL Pattern

In Example 17.55 ...

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.