Commit 07b31f40 authored by Migs Atienza's avatar Migs Atienza

Added add author html

parent b80b35b6
{% extends 'base.html' %}
{% block title %}Add New Author{% endblock %}
{% block content %}<center>
<form action="" method="post">
{% csrf_token %}
<table>
{{ form.as_table }}
</table>
<input type="submit" value="Add Author" />
</form>
</center>{% endblock %}
{% block links %}
<center><br/><br/><br/><br/><br/>
<a href="/bookshelf/home">Home</a>
<a href="/bookshelf/books">Books</a>
<a href="/bookshelf/authors">Authors</a></center>
{% endblock %}
\ No newline at end of file
from django.urls import path from django.urls import path
from .views import index, home_view, BooksListView, BooksDetailView, BooksCreateView, AuthorsListView, \ from .views import index, home_view, BooksListView, BooksDetailView, BooksCreateView, AuthorsListView, \
AuthorsDetailView AuthorsDetailView, AuthorsCreateView
urlpatterns = [ urlpatterns = [
path('', index, name='index'), path('', index, name='index'),
...@@ -11,6 +11,7 @@ urlpatterns = [ ...@@ -11,6 +11,7 @@ urlpatterns = [
path('books/add', BooksCreateView.as_view(), name='add_book'), path('books/add', BooksCreateView.as_view(), name='add_book'),
path('authors', AuthorsListView.as_view(), name='authors_list'), path('authors', AuthorsListView.as_view(), name='authors_list'),
path('authors/<int:pk>/details', AuthorsDetailView.as_view(), name='authors_details'), path('authors/<int:pk>/details', AuthorsDetailView.as_view(), name='authors_details'),
path('authors/add', AuthorsCreateView.as_view(), name='add_author'),
] ]
app_name = "<bookshelf>" app_name = "<bookshelf>"
......
...@@ -41,5 +41,8 @@ class AuthorsDetailView(DetailView): ...@@ -41,5 +41,8 @@ class AuthorsDetailView(DetailView):
template_name = "bookshelf/authors_details.html" template_name = "bookshelf/authors_details.html"
class AuthorsCreateView(CreateView):
model = Author
fields = '__all__'
template_name = "bookshelf/add-author.html"
# Create your views here. # Create your views here.
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