Commit 2edea7af authored by Gabriel G. Garrero's avatar Gabriel G. Garrero

Updated urls.py and views.py to account for add author function

parent e136d6e0
from django.urls import path
from .views import (
home, BooksListView, BooksDetailView, BooksCreateView,
AuthorListView, AuthorDetailView
AuthorListView, AuthorDetailView, AuthorCreateView
)
urlpatterns = [
......@@ -11,6 +11,7 @@ urlpatterns = [
path('books/add', BooksCreateView.as_view(), name = 'add-book'),
path('authors/', AuthorListView.as_view(), name = 'author-list'),
path('authors/<int:pk>/details', AuthorDetailView.as_view(), name = 'author-details'),
path('authors/add', AuthorCreateView.as_view(), name = 'add-author'),
]
app_name = "bookshelf"
\ No newline at end of file
......@@ -28,3 +28,8 @@ class AuthorListView(ListView):
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
class AuthorCreateView(CreateView):
model = Author
template_name = 'bookshelf/add-author.html'
fields = '__all__'
\ 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