used CBV implmentation to create BookListView and BookDetailView

parent 5765a3fc
...@@ -8,3 +8,13 @@ from .models import Author, Book ...@@ -8,3 +8,13 @@ from .models import Author, Book
def HomeView(request): def HomeView(request):
return render(request, "bookshelf/home.html") return render(request, "bookshelf/home.html")
class BookListView(ListView):
model = Book
template_name = 'bookshelf/books.html'
class BookDetailView(DetailView):
model = Book
template_name = 'bookshelf/book_details.html'
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment