Ticket #697: django.patch
File django.patch, 1.6 KB (added by , 19 years ago) |
---|
-
django/views/generic/date_based.py
51 51 52 52 def archive_year(request, year, app_label, module_name, date_field, 53 53 template_name=None, template_loader=template_loader, 54 extra_lookup_kwargs={}, extra_context={} ):54 extra_lookup_kwargs={}, extra_context={}, make_object_list=False): 55 55 """ 56 56 Generic yearly archive view. 57 57 … … 61 61 List of months in this year with objects 62 62 year 63 63 This year 64 object_list 65 list of objects published in the given year 66 Only when keyword argumement make_object_list=True 64 67 """ 65 68 mod = get_module(app_label, module_name) 66 69 now = datetime.datetime.now() … … 72 75 date_list = getattr(mod, "get_%s_list" % date_field)('month', **lookup_kwargs) 73 76 if not date_list: 74 77 raise Http404 78 if make_object_list: 79 lookup_kwargs.update({'order_by': ('-' + date_field,)}) 80 object_list = mod.get_list(**lookup_kwargs) 81 else: 82 object_list = [] 75 83 if not template_name: 76 84 template_name = "%s/%s_archive_year" % (app_label, module_name) 77 85 t = template_loader.get_template(template_name) 78 86 c = Context(request, { 79 87 'date_list': date_list, 80 88 'year': year, 89 'object_list':object_list, 81 90 }) 82 91 for key, value in extra_context.items(): 83 92 if callable(value):