How do I pass the context used on the child template TO the parent template it inherits from?
Example:
in views.py
def author(request, code):
author = get_object_or_404(Author, code=code)
books = Book.objects.filter(author_id=author.id)
reviews = Review.objects.filter(author_id=author)
return render(request, 'foo/author.html', {'author': author, 'books': books, 'reviews': reviews})
in author.html
{% extends 'base.html' %}
in base.html
{% for book in books %}
<ul>
<li>{{ book.title }}</li>
<li>{{ book.year_published }}</li>
</ul>
{% endfor %}
This is for the navigation bar that's inside the parent template('base.html'). It changes depending on which author page you are on.