diff --git a/django/views/generic/date_based.py b/django/views/generic/date_based.py
a
|
b
|
|
10 | 10 | def archive_index(request, queryset, date_field, num_latest=15, |
11 | 11 | template_name=None, template_loader=loader, |
12 | 12 | extra_context=None, allow_empty=True, context_processors=None, |
13 | | mimetype=None, allow_future=False, template_object_name='latest'): |
| 13 | mimetype=None, allow_future=False, template_object_name='latest', |
| 14 | date_list_period='year'): |
14 | 15 | """ |
15 | 16 | Generic top-level archive of date-based objects. |
16 | 17 | |
… |
… |
|
25 | 26 | model = queryset.model |
26 | 27 | if not allow_future: |
27 | 28 | queryset = queryset.filter(**{'%s__lte' % date_field: datetime.datetime.now()}) |
28 | | date_list = queryset.dates(date_field, 'year')[::-1] |
| 29 | if date_list_period == 'month': |
| 30 | date_list = queryset.dates(date_field, 'month')[::-1] |
| 31 | else: |
| 32 | date_list = queryset.dates(date_field, 'year')[::-1] |
29 | 33 | if not date_list and not allow_empty: |
30 | 34 | raise Http404, "No %s available" % model._meta.verbose_name |
31 | 35 | |
diff --git a/docs/ref/generic-views.txt b/docs/ref/generic-views.txt
a
|
b
|
|
232 | 232 | * ``template_object_name``: Designates the name of the template variable |
233 | 233 | to use in the template context. By default, this is ``'latest'``. |
234 | 234 | |
| 235 | .. versionadded:: 1.1 |
| 236 | |
| 237 | * ``date_list_period``: Specifies what date period is placed in |
| 238 | ``date_list``. Acceptable values are ``'year'`` and ``'month'``. By |
| 239 | default, this is ``'year'``. |
| 240 | |
235 | 241 | **Template name:** |
236 | 242 | |
237 | 243 | If ``template_name`` isn't specified, this view will use the template |