def get_context_object_name(self, object_list):
"""Get the name of the item to be used in the context.
See original in ``django.views.generic.list.MultipleObjectMixin``.
"""
if self.context_object_name:
return self.context_object_name
elif hasattr(object_list, 'model'):
object_name = object_list.model._meta.object_name.lower()
return smart_str('{0}_list'.format(object_name))
else:
return None
评论列表
文章目录