﻿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
14532	django.views.generic.list_detail.object_list behavior with callables in extra_context	jpileborg	nobody	"When using django.views.generic.list_detail.object_list, if it is called with an extra_context parameter that contains an entry with a callable, that callable will be called when copying the extra context to the actual context. This behavior is not always wanted.

In my application, the extra_context contains an object instance in which the class have a custom __call__ method. Since my __call__ method have some required parameters, I will get an error when trying to display the page using the view.

The callable should only be called if it is a function. If the user of object_list wants a callable object in the extra_context, then the user should call the object instance when adding the object to the context dictionary.

I changed the code in django/views/generic/list_detail.py on line 93 to 96 to:

{{{
        import types
        if isinstance(value, types.FunctionType):
            c[key] = value()
        else:
            c[key] = value

}}}
"		closed	Uncategorized	1.2		wontfix			Unreviewed	0	0	0	0	0	0
