Commit 7d5898c2 authored by Eury See's avatar Eury See

Updated Book’s Details Page and Per Author’s Details Page. Added Edit Book...

Updated Book’s Details Page and Per Author’s Details Page. Added Edit Book Page and Edit Author Page.
parent 91a06345
...@@ -9,15 +9,16 @@ ...@@ -9,15 +9,16 @@
<h1>{{ object.first_name }} {{ object.last_name }}</h1> <h1>{{ object.first_name }} {{ object.last_name }}</h1>
</div> </div>
<li> <li>{{ object.age }}</li>
{{ object.age }} <li>{{ object.nationality }}</li>
</li> <li>{{ object.bio }}</li>
<li>
{{ object.nationality }} <br>
</li>
<li> <button type="submit">
{{ object.bio }} <a href="{% url 'bookshelf:edit-author' pk=author.pk %}">Edit Author</a>
</li> </button>
</form>
<p>Books by {{ object.first_name }} {{ object.last_name }} that I love:</p> <p>Books by {{ object.first_name }} {{ object.last_name }} that I love:</p>
......
...@@ -13,6 +13,13 @@ ...@@ -13,6 +13,13 @@
<li>{{ object.ISBN }}</li> <li>{{ object.ISBN }}</li>
<li>{{ object.blurb }}</li> <li>{{ object.blurb }}</li>
<br>
<button type="submit">
<a href="{% url 'bookshelf:edit-book' pk=books.pk %}">Edit Book</a>
</button>
</form>
<p style="text-align: center;"><a href="http://127.0.0.1:8000/bookshelf/home">Home</a> <a href="http://127.0.0.1:8000/bookshelf/books">Books</a> <a href="http://127.0.0.1:8000/bookshelf/authors">Authors</a></p> <p style="text-align: center;"><a href="http://127.0.0.1:8000/bookshelf/home">Home</a> <a href="http://127.0.0.1:8000/bookshelf/books">Books</a> <a href="http://127.0.0.1:8000/bookshelf/authors">Authors</a></p>
{% block styles %} {% block styles %}
......
{% extends 'bookshelf/base.html' %}
{% load static %}
{% block title %} Edit Author {% endblock %}
{% block content %}
<link rel="stylesheet" href="{% static 'styles.css' %"}>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Save Changes</button>
</form>
{% block styles %}
<style>
body {
background-color: #E8D1C5;
font-family: Georgia, serif;
font-size: 16px;
font-weight: bold;
color: #a77f6a;
}
</style>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
{% extends 'bookshelf/base.html' %}
{% load static %}
{% block title %} Edit Book {% endblock %}
{% block content %}
<link rel="stylesheet" href="{% static 'styles.css' %"}>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Save Changes</button>
</form>
{% block styles %}
<style>
body {
background-color: #cee0c2;
font-family: Georgia, serif;
font-size: 16px;
font-weight: bold;
color: #75975E;
}
</style>
{% endblock %}
</div>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import ( from .views import (
BooksListView,BooksDetailView, AuthorListView, BooksListView,BooksDetailView, AuthorListView,
AuthorDetailView, AddBooksView, AddAuthorsView) AuthorDetailView, AddBooksView, AddAuthorsView,
# EditBooksView, EditAuthorsView EditBooksView, EditAuthorsView)
from . import views from . import views
urlpatterns = [ urlpatterns = [
...@@ -13,8 +13,8 @@ urlpatterns = [ ...@@ -13,8 +13,8 @@ urlpatterns = [
path("authors/<int:pk>/details", AuthorDetailView.as_view(), name = "author-detail"), path("authors/<int:pk>/details", AuthorDetailView.as_view(), name = "author-detail"),
path("books/add/", AddBooksView.as_view(), name = "add-book"), path("books/add/", AddBooksView.as_view(), name = "add-book"),
path("authors/add/", AddAuthorsView.as_view(), name = "add-author"), path("authors/add/", AddAuthorsView.as_view(), name = "add-author"),
# path("books/<int:pk>/edit/", EditBooksView.as_view(), name = "edit-book"), path("books/<int:pk>/edit/", EditBooksView.as_view(), name = "edit-book"),
# path("authors/<int:pk>/edit/", EditAuthorsView.as_view(), name = "edit-author"), path("authors/<int:pk>/edit/", EditAuthorsView.as_view(), name = "edit-author"),
] ]
app_name = "bookshelf" app_name = "bookshelf"
\ No newline at end of file
...@@ -48,12 +48,12 @@ class AddAuthorsView(CreateView): ...@@ -48,12 +48,12 @@ class AddAuthorsView(CreateView):
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/add-author.html' template_name = 'bookshelf/add-author.html'
# class EditBooksView(UpdateView): class EditBooksView(UpdateView):
# model = Author model = Books
# fields = '__all__' fields = '__all__'
# template_name = 'bookshelf/edit-book.html' template_name = 'bookshelf/edit-book.html'
# class EditAuthorsView(UpdateView): class EditAuthorsView(UpdateView):
# model = Author model = Author
# fields = '__all__' fields = '__all__'
# template_name = 'bookshelf/edit-author.html' template_name = 'bookshelf/edit-author.html'
\ No newline at end of file \ 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