Ticket #1399: django_template_model_name.diff
File django_template_model_name.diff, 2.1 KB (added by , 19 years ago) |
---|
-
H:/Programming/Python/Python24/Lib/site-packages/django/views/generic/list_detail.py
6 6 7 7 def object_list(request, queryset, paginate_by=None, allow_empty=False, 8 8 template_name=None, template_loader=loader, 9 extra_context={}, context_processors=None ):9 extra_context={}, context_processors=None, template_model_name='object'): 10 10 """ 11 11 Generic list of objects. 12 12 … … 47 47 raise Http404 48 48 page = int(page) 49 49 c = RequestContext(request, { 50 ' object_list': object_list,50 '%(template_model_name)s_list' % {'template_model_name': template_model_name}: object_list, 51 51 'is_paginated': paginator.pages > 1, 52 52 'results_per_page': paginate_by, 53 53 'has_next': paginator.has_next_page(page), … … 60 60 }, context_processors) 61 61 else: 62 62 c = RequestContext(request, { 63 ' object_list': queryset,63 '%(template_model_name)s_list' % {'template_model_name': template_model_name}: queryset, 64 64 'is_paginated': False 65 65 }, context_processors) 66 66 if not allow_empty and len(queryset) == 0: … … 78 78 def object_detail(request, queryset, object_id=None, slug=None, 79 79 slug_field=None, template_name=None, template_name_field=None, 80 80 template_loader=loader, extra_context={}, 81 context_processors=None ):81 context_processors=None, template_model_name='object'): 82 82 """ 83 83 Generic list of objects. 84 84 … … 106 106 else: 107 107 t = template_loader.get_template(template_name) 108 108 c = RequestContext(request, { 109 'object': object,109 template_model_name: object, 110 110 }, context_processors) 111 111 for key, value in extra_context.items(): 112 112 if callable(value):