Commit cd9843e4 authored by Agu Syquia's avatar Agu Syquia

Updated views.py

Fixed the classes and functions and implemented ListView and DetailView
parent 846d6d6d
from django.shortcuts import render
from django.http import HttpResponse
from .models import Author, Books
from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from .models import Books, Author
def home_view(request):
return render(request, 'bookshelf/home.html')
class BooksView(ListView):
model = Books
template_name = 'bookshelf/books.html'
class BooksDetailsView(DetailView):
model = Books
class AuthorsView(ListView):
model = Author
template_name = 'bookshelf/authors.html'
class AuthorsDetailsView(DetailView):
model = Author
def bookshelfIndex(request):
bookshelf_output = ''
return HttpResponse(bookshelf_output)
# Create your views here.
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