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

c# - how to write client side events functions for the combobox items -

exception - Python, pyPdf OCR error: pyPdf.utils.PdfReadError: EOF marker not found -