Commit 2b1f993b authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Updated BookDetailsPage. Added EditBookPage.

parent 33b5ff59
......@@ -8,6 +8,9 @@
{{ object.year_published }}<br>
{{ object.ISBN }}<br>
{{ object.blurb }}<br>
<a href="{% url 'bookshelf:edit-book' book.id %}">
<button>Edit Book</button>
</a>
</p>
<a href="{% url 'bookshelf:home' %}">Home</a>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
......
{% extends 'base.html' %}
{% block title %}Edit Book{% endblock %}
{% block content %}
<form method="POST">
{% csrf_token %}
{{ form.as_p }}
<input type="Submit" value="Save Changes">
</form>
{% endblock %}
\ No newline at end of file
......@@ -3,7 +3,7 @@ from django.urls import path
from . import views
from .views import (
BooksListView, BookDetailsView, AuthorsListView, AuthorDetailsView,
BookCreateView, AuthorCreateView
BookCreateView, AuthorCreateView, BookUpdateView
)
urlpatterns = [
......@@ -14,6 +14,7 @@ urlpatterns = [
path('authors/<int:pk>/details/', AuthorDetailsView.as_view(), name = "author-detail"),
path('books/add/', BookCreateView.as_view(), name = "add-book"),
path('authors/add/', AuthorCreateView.as_view(), name = "add-author"),
path('books/<int:pk>/edit/', BookUpdateView.as_view(), name = "edit-book"),
]
app_name = 'bookshelf'
\ No newline at end of file
......@@ -35,3 +35,8 @@ class AuthorCreateView(CreateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/add-author.html'
class BookUpdateView(UpdateView):
model = Book
fields = '__all__'
template_name = 'bookshelf/edit-book.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