added forms.py and hyperlinks

parent 0297cda7
......@@ -19,3 +19,8 @@ I enjoy a plethora of genres. as long as the author imerses me in their world, t
<a href="/books">Books</a>
<a href="/authors">Authors</a>
{%endblock%}
{%block hyperlinks%}
<a href="/books/add">Add Book</a>
<a href="/authors/add">Add Author</a>
{%endblock%}
\ No newline at end of file
from django.urls import path
from .views import home_view, BookListView, AuthorsListView, BookDetailsView, AuthorDetailsView
from .views import home_view, BookListView, AuthorsListView, BookDetailsView, AuthorDetailsView, AddBookView, AddAuthorView
urlpatterns = [
path('', home_view, name="My Favorite Books & Authors"),
......@@ -10,6 +10,10 @@ urlpatterns = [
path('authors/', AuthorsListView.as_view(), name ="author-list"),
path('authors/<int:pk>/details/', AuthorDetailsView.as_view(), name ="author-detail"),
path('books/add/', AddBookView.as_view(), name ="add-book"),
path('authors/add/', AddAuthorView.as_view(), name ="add-author"),
]
app_name = 'bookshelf'
\ No newline at end of file
......@@ -31,3 +31,13 @@ class AuthorDetailsView(DetailView):
# Add in a QuerySet of all the books
context['book_list'] = Book.objects.all()
return context
class AddBookView(ListView):
template_name = "bookshelf/add-book.html"
model = Author
class AddAuthorView(ListView):
template_name = "bookshelf/add-author.html"
model = Author
\ 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