O'Reilly logo

Django Unleashed by Andrew Pinkham

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required