Ticket #14878: generic.diff
File generic.diff, 1.5 KB (added by , 14 years ago) |
---|
-
django/views/generic/list.py
1 1 from django.core.paginator import Paginator, InvalidPage 2 2 from django.core.exceptions import ImproperlyConfigured 3 3 from django.http import Http404 4 from django.utils.encoding import smart_str5 4 from django.views.generic.base import TemplateResponseMixin, View 6 5 7 6 class MultipleObjectMixin(object): … … 74 73 Get the name of the item to be used in the context. 75 74 """ 76 75 if self.context_object_name: 77 return self.context_object_name 78 elif hasattr(object_list, 'model'): 79 return smart_str(object_list.model._meta.verbose_name_plural) 76 return self.context_object_name+'_list' 80 77 else: 81 return None78 return 'object_list' 82 79 83 80 def get_context_data(self, **kwargs): 84 81 """ … … 92 89 'paginator': paginator, 93 90 'page_obj': page, 94 91 'is_paginated': is_paginated, 95 'object_list': queryset96 92 } 97 93 else: 98 94 context = { 99 95 'paginator': None, 100 96 'page_obj': None, 101 97 'is_paginated': False, 102 'object_list': queryset103 98 } 104 99 context.update(kwargs) 105 100 context_object_name = self.get_context_object_name(queryset)