Commit 41553be2 authored by Mavrick Jordan Lee's avatar Mavrick Jordan Lee

Updated AuthorDetailsPage. Added EditAuthorPage.

parent 2b1f993b
......@@ -6,6 +6,9 @@
{{ object.age }}<br>
{{ object.nationality }}<br>
{{ object.bio }}<br>
<a href="{% url 'bookshelf:edit-author' author.id %}">
<button>Edit Author</button>
</a><br>
Books by {{ object.first_name }} {{ object.last_name }} I love:
</p>
<ul>
......
{% extends 'base.html' %}
{% block title %}Edit Author{% 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, BookUpdateView
BookCreateView, AuthorCreateView, BookUpdateView, AuthorUpdateView
)
urlpatterns = [
......@@ -15,6 +15,7 @@ urlpatterns = [
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"),
path('authors/<int:pk>/edit/', AuthorUpdateView.as_view(), name = "edit-author"),
]
app_name = 'bookshelf'
\ No newline at end of file
......@@ -39,4 +39,9 @@ class AuthorCreateView(CreateView):
class BookUpdateView(UpdateView):
model = Book
fields = '__all__'
template_name = 'bookshelf/edit-book.html'
\ No newline at end of file
template_name = 'bookshelf/edit-book.html'
class AuthorUpdateView(UpdateView):
model = Author
fields = '__all__'
template_name = 'bookshelf/edit-author.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