Commit 25008b04 authored by Ross Batacan's avatar Ross Batacan

added edit feature on author_details.html and created template...

added edit feature on author_details.html and created template edit-author.html. changed value for submit button under book-details.html from Edit to Edit Book
parent 44333974
...@@ -15,6 +15,9 @@ ...@@ -15,6 +15,9 @@
</li> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<a href="{% url 'bookshelf:author-edit' author.id %}"><button>Edit Author</button></a>
<br><br>
<a href="{% url 'bookshelf:home' %}">Home</a> <a href="{% url 'bookshelf:home' %}">Home</a>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
<a href="{% url 'bookshelf:books' %}">Books</a> <a href="{% url 'bookshelf:books' %}">Books</a>
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
{{ books.blurb }}<br> {{ books.blurb }}<br>
</p> </p>
<a href="{% url 'bookshelf:book-edit' books.id %}"><button>Edit</button></a> <a href="{% url 'bookshelf:book-edit' books.id %}"><button>Edit Book</button></a>
<br><br> <br><br>
<a href="{% url 'bookshelf:home' %}">Home</a> <a href="{% url 'bookshelf:home' %}">Home</a>
&nbsp&nbsp&nbsp&nbsp &nbsp&nbsp&nbsp&nbsp
......
{% extends 'base.html' %}
{% block title %}Add New 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
from django.urls import path from django.urls import path
from . import views from . import views
from .views import BooksListView, BooksDetailsView, AuthorsListView, AuthorDetailsView, BookCreateView, AuthorCreateView, BookEditView from .views import BooksListView, BooksDetailsView, AuthorsListView, AuthorDetailsView, BookCreateView, AuthorCreateView, BookEditView, AuthorEditView
urlpatterns = [ urlpatterns = [
path('home/', views.home, name="home"), path('home/', views.home, name="home"),
...@@ -12,6 +12,7 @@ urlpatterns = [ ...@@ -12,6 +12,7 @@ urlpatterns = [
path('books/add', BookCreateView.as_view(), name='book-add'), path('books/add', BookCreateView.as_view(), name='book-add'),
path('authors/add', AuthorCreateView.as_view(), name='author-add'), path('authors/add', AuthorCreateView.as_view(), name='author-add'),
path('books/<int:pk>/edit/', BookEditView.as_view(), name='book-edit'), path('books/<int:pk>/edit/', BookEditView.as_view(), name='book-edit'),
path('author/<int:pk>/edit/', AuthorEditView.as_view(), name='author-edit'),
] ]
......
...@@ -39,4 +39,9 @@ class AuthorCreateView(CreateView): ...@@ -39,4 +39,9 @@ class AuthorCreateView(CreateView):
class BookEditView(UpdateView): class BookEditView(UpdateView):
model = Books model = Books
fields = '__all__' fields = '__all__'
template_name = 'bookshelf/edit-book.html' template_name = 'bookshelf/edit-book.html'
\ No newline at end of file
class AuthorEditView(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