Commit 1934475c authored by enricosuplico's avatar enricosuplico

updated views.py

parent b55227b2
......@@ -3,6 +3,7 @@ from django.http import HttpResponse
from django.views import View
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView, UpdateView
from .models import Author, Books
......@@ -10,7 +11,7 @@ def Homepage_View(request):
return render(request, 'bookshelf/home.html')
class Books_List_View(ListView):
models = Books
model = Books
template_name = 'bookshelf/books.html'
class Books_Detail_View(DetailView):
......@@ -23,5 +24,25 @@ class Authors_List_View(ListView):
class Authors_Detail_View(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
template_name = 'bookshelf/authors_details.html'
class Book_Create_View(CreateView):
model = Books
fields = '__all__'
template_name = 'bookshelf/add-book.html'
class Author_Create_View(CreateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/add-author.html'
class Book_Update_View(UpdateView):
model = Books
fields = '__all__'
template_name = 'bookshelf/edit-book.html'
class Author_Update_View(UpdateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/edit-author.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