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

Updated AuthorDetailsPage. Added EditAuthorPage.

parent 2b1f993b
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
{{ object.age }}<br> {{ object.age }}<br>
{{ object.nationality }}<br> {{ object.nationality }}<br>
{{ object.bio }}<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: Books by {{ object.first_name }} {{ object.last_name }} I love:
</p> </p>
<ul> <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 ...@@ -3,7 +3,7 @@ from django.urls import path
from . import views from . import views
from .views import ( from .views import (
BooksListView, BookDetailsView, AuthorsListView, AuthorDetailsView, BooksListView, BookDetailsView, AuthorsListView, AuthorDetailsView,
BookCreateView, AuthorCreateView, BookUpdateView BookCreateView, AuthorCreateView, BookUpdateView, AuthorUpdateView
) )
urlpatterns = [ urlpatterns = [
...@@ -15,6 +15,7 @@ urlpatterns = [ ...@@ -15,6 +15,7 @@ urlpatterns = [
path('books/add/', BookCreateView.as_view(), name = "add-book"), path('books/add/', BookCreateView.as_view(), name = "add-book"),
path('authors/add/', AuthorCreateView.as_view(), name = "add-author"), path('authors/add/', AuthorCreateView.as_view(), name = "add-author"),
path('books/<int:pk>/edit/', BookUpdateView.as_view(), name = "edit-book"), 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' app_name = 'bookshelf'
\ No newline at end of file
...@@ -40,3 +40,8 @@ class BookUpdateView(UpdateView): ...@@ -40,3 +40,8 @@ class BookUpdateView(UpdateView):
model = Book model = Book
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/edit-book.html' 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