1from django.views.generic import DetailView
2from books.models import Publisher
3
4class PublisherDetail(DetailView):
5
6 context_object_name = 'publisher'
7 queryset = Publisher.objects.all()
8
1class PublisherDetail(DetailView):
2
3 model = Publisher
4
5 def get_context_data(self, **kwargs):
6 # Call the base implementation first to get a context
7 context = super().get_context_data(**kwargs)
8 # Add in a QuerySet of all the books
9 context['book_list'] = Book.objects.all()
10 return context