Commit 1aeab1d4 authored by Trisha Angel Millena's avatar Trisha Angel Millena

Edited views.py: Added class AuthorUpdateView, Edited urls.py: Added...

Edited views.py: Added class AuthorUpdateView, Edited urls.py: Added path('authors/<int:pk>/edit/), Created editor-author.html
parent b703e918
{% extends 'base.html' %}
{% load static %}
{% 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
from django.urls import path from django.urls import path
from .views import (home, BooksListView, BooksDetailView, AuthorListView, AuthorDetailView, BooksCreateView, AuthorCreateView, BooksUpdateView) from .views import (home, BooksListView, BooksDetailView, AuthorListView, AuthorDetailView, BooksCreateView, AuthorCreateView, BooksUpdateView, AuthorUpdateView)
urlpatterns = [ urlpatterns = [
path('home/', home, name = 'home'), path('home/', home, name = 'home'),
...@@ -10,7 +10,7 @@ urlpatterns = [ ...@@ -10,7 +10,7 @@ urlpatterns = [
path('books/add/', BooksCreateView.as_view(), name = "add-book"), path('books/add/', BooksCreateView.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/', BooksUpdateView.as_view(), name = "edit-book") path('books/<int:pk>/edit/', BooksUpdateView.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 BooksUpdateView(UpdateView): ...@@ -40,3 +40,8 @@ class BooksUpdateView(UpdateView):
model = Books model = Books
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