Added additional urls for the added htmls. Also fixed names of urls as they...

Added additional urls for the added htmls. Also fixed names of urls as they did not match the urls on the other.
parent c6b186bb
from django.urls import path
from .views import home_view, BooksView, BooksDetailView, AuthorView, AuthorDetailView
from .views import home_view, BooksView, BooksDetailView, AuthorView, AuthorDetailView, BookCreateView, BookUpdateView, AuthorCreateView, AuthorUpdateView
urlpatterns = [
path('', home_view, name='home'),
......@@ -7,6 +7,11 @@ urlpatterns = [
path('books/<int:pk>/details/', BooksDetailView.as_view(), name='book-details'),
path('author/', AuthorView.as_view(), name='author'),
path('author/<int:pk>/details/', AuthorDetailView.as_view(), name='author-details'),
path('books/add/', BookCreateView.as_view(), name='add-book'),
path('authors/add/', AuthorCreateView.as_view(), name='add-author'),
path('books/<pk>/edit/', BookUpdateView.as_view(), name='edit-book'),
path('authors/<pk>/edit/', AuthorUpdateView.as_view(), name='edit-author'),
]
# This might be needed depending on your Django version
app_name = "bookshelf"
\ No newline at end of file
......@@ -10,17 +10,17 @@ def home_view(request):
return render(request, 'bookshelf/home.html', {'nickname': 'Dani'})
class AuthorsListView(ListView):
class AuthorView(ListView):
model = Author
template_name = 'bookshelf/authors.html'
class AuthorsDetailView(DetailView):
class AuthorDetailView(DetailView):
model = Author
template_name = 'bookshelf/author_details.html'
class BooksListView(ListView):
class BooksView(ListView):
model = Books
template_name = 'bookshelf/books.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