Commit 37c0c264 authored by Jan Ericsson Ong Ang's avatar Jan Ericsson Ong Ang

fixed views.py and urls.py

parent 44ba6191
from django.urls import path
from .views import
from .views import HomeView, AuthorView, AuthorDetailView, BooksView, BookDetailView
# url for bookshelf
urlpatterns = [
path('', views.bookshelfIndex, name='bookshelfIndex'),
path('', views.bookshelfIndex, name='bookshelfIndex'),
path('', views.bookshelfIndex, name='bookshelfIndex'),
path('', HomeView.as_view(), name='homepage'),
path('author', AuthorView.as_view(), name='author-list'),
path('author/<int:pk>', AuthorDetailView.as_view(), name='author-detail'),
path('boooks', BooksView.as_view(), name='books-list'),
path('books/<int:pk>', BookDetailView.as_view(), name='books-detail'),
]
\ No newline at end of file
......@@ -8,18 +8,18 @@ from .models import Author, Books
def HomeView(request):
return render(request, 'bookshelf/home.html', {'nickname': 'Jan'})
class BooksView(ListView):
model = Books
template_name = 'bookshelf/books.html'
class BookDetailsView(DetailView):
model = Books
template_name = 'bookshelf/books_details.html'
class AuthorView(ListView):
model = Author
template_name = 'bookshelf/author.html'
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
\ No newline at end of file
template_name = 'bookshelf/author_details.html'
class BooksView(ListView):
model = Books
template_name = 'bookshelf/books.html'
class BookDetailView(DetailView):
model = Books
template_name = 'bookshelf/books_details.html'
\ No newline at end of file
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