﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
14878	Issues in generic views (list)	Diego Andrés Sanabria Martín	nobody	"The code in http://code.djangoproject.com/browser/django/trunk/django/views/generic/list.py have a 'wrong' behavior

{{{
    def get_context_object_name(self, object_list):
        """"""
        Get the name of the item to be used in the context.
        """"""
        if self.context_object_name:
            return self.context_object_name
        elif hasattr(object_list, 'model'):
            return smart_str(object_list.model._meta.verbose_name_plural)
        else:
            return None

    def get_context_data(self, **kwargs):
        """"""
        Get the context for this view.
        """"""
        queryset = kwargs.pop('object_list')
        page_size = self.get_paginate_by(queryset)
        if page_size:
            paginator, page, queryset, is_paginated = self.paginate_queryset(queryset, page_size)
            context = {
                'paginator': paginator,
                'page_obj': page,
                'is_paginated': is_paginated,
                'object_list': queryset
            }
        else:
            context = {
                'paginator': None,
                'page_obj': None,
                'is_paginated': False,
                'object_list': queryset
            }
        context.update(kwargs)
        context_object_name = self.get_context_object_name(queryset)
        if context_object_name is not None:
            context[context_object_name] = queryset
        return context
}}}


 * The method get_context_object_name take the verbose_name_plural of the models which could contains spaces or be a translated string
 * The generated context_object_name don't ends in '_list' and could be a backward compatibility problem
 * In the documentation of Class-Based Generic Views dont talk about the context will have a variable from the models name
 * The context result contains twice the queryset, first in 'objects_list' and second in the new dinamic generated and if the user/developer want to serialize the data to json or cvs or xml in a generic way, i mean write something like a JSONResponseMixin the data will have duplicate queryset, that don't looks right
"		closed	Generic views	1.3-alpha		fixed		camilo.nova@…	Accepted	1	0	1	1	0	0
