Reputation: 1920
I am trying to send the listview context (book_list) in this case to more than one template at the same time.
I have tried to edit templates_names by doing this:
class BookListView(ListView):
model = Book
def get_template_names(self):
template_name=["catalog/index.html","catalog/book_list.html"]
return template_name
but book_list is still only known to catalog/book_list.html not to catalog/index.html(so the function I have added did NOT do anything).
any suggestions please?
Best regards
Upvotes: 1
Views: 443
Reputation: 11
render multiple template from a single view in django
I had same problem. If you send arguments to parents html and if your htmls are children. They can access to arguments. check the link.
Upvotes: 1
Reputation: 4267
You just cannot :) Each view is responsible for one url and one template in will render. Actually I cannot even find and example when one would need to do what you're trying to do.
I think you have to read about template inheritance
Upvotes: 1