Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django.views.generic import DetailView
- from books.models import Book, Publisher
- class PublisherDetailView(DetailView):
- model = Publisher
- def get_context_data(self, **kwargs):
- # Call the base implementation first to get a context
- context = super().get_context_data(**kwargs)
- # Add in a QuerySet of all the books
- context['book_list'] = Book.objects.all()
- return context
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement