What is context_object_name in django views? -


i'm new django. , i'm studying using class-based generic views. please explain aim , use of context_object_name attribute?

if not provide "context_object_name", view may this:

<ul>     {% publisher in object_list %}         <li>{{ publisher.name }}</li>     {% endfor %} </ul> 

but if provide {"context_object_name": "publisher_list"}, can write view like:

<ul>     {% publisher in publisher_list %}         <li>{{ publisher.name }}</li>     {% endfor %} </ul> 

that means can change original parameter name(object_list) name through "context_object_name" view. hope help:)


Comments

Popular posts from this blog

haskell - Using filter on an item in a list? -

c# - When does PreApplicationStartMethod actually get triggered to run? -

tomcat6 - Exception when stopping container for a with Spring + Quartz + Tomcat web application -