I'm new to django. And now I'm studying using the class-based generic views. Could someone please explain the aim and use of context_object_name attribute?
If you do not provide "context_object_name", your view may look like this:
<ul>
{% for publisher in object_list %}
<li>{{ publisher.name }}</li>
{% endfor %}
</ul>
But if you provide like {"context_object_name": "publisher_list"}, then you can write view like:
<ul>
{% for publisher in publisher_list %}
<li>{{ publisher.name }}</li>
{% endfor %}
</ul>
That means you can change the original parameter name(object_list) into any name through "context_object_name" for your view. Hope that help:)