post_list variable in post_list.html

Hi,

in post_list.html we add {% for post in post_list %}

However in views.py we replaced the function based view of blog_list that defined post_list with a class based view that just contains model=Post. I am wondering how the post_list variable still exists as I cant find anywhere else it is defined.

Sorry You must be a logged in, registered user to answer a question.

Answers

ListView and DetailView both do a really neat thing. They auto-create object_list and object (respectively) for your context, but they also create <model_name>_list and <model_name> for you, too.