diff -urNp django-svn/django/views/generic/date_based.py django/django/views/generic/date_based.py
old
|
new
|
def archive_index(request, queryset, dat
|
49 | 49 | def archive_year(request, year, queryset, date_field, template_name=None, |
50 | 50 | template_loader=loader, extra_context=None, allow_empty=False, |
51 | 51 | context_processors=None, template_object_name='object', mimetype=None, |
52 | | make_object_list=False, allow_future=False): |
| 52 | make_object_list=False, allow_future=False, order_by=None): |
53 | 53 | """ |
54 | 54 | Generic yearly archive view. |
55 | 55 | |
… |
… |
def archive_year(request, year, queryset
|
76 | 76 | if not date_list and not allow_empty: |
77 | 77 | raise Http404 |
78 | 78 | if make_object_list: |
79 | | object_list = queryset.filter(**lookup_kwargs).order_by(date_field) |
| 79 | order_by = order_by or date_field |
| 80 | object_list = queryset.filter(**lookup_kwargs).order_by(order_by) |
80 | 81 | else: |
81 | 82 | object_list = [] |
82 | 83 | if not template_name: |
diff -urNp django-svn/docs/generic_views.txt django/docs/generic_views.txt
old
|
new
|
to ``True``.
|
285 | 285 | specified in ``date_field`` is greater than the current date/time. By |
286 | 286 | default, this is ``False``. |
287 | 287 | |
| 288 | * ``order_by``: The name of the field in the ``QuerySet``'s model that the |
| 289 | date-based archive should use to determine the order of the objects. By |
| 290 | default objects are ordered chronologically by ``date_field``. |
| 291 | |
288 | 292 | **Template name:** |
289 | 293 | |
290 | 294 | If ``template_name`` isn't specified, this view will use the template |