Commit edf0e30e authored by Trisha Angel Millena's avatar Trisha Angel Millena

Edited views.py and add-book.html

parent 76cee439
...@@ -3,18 +3,15 @@ ...@@ -3,18 +3,15 @@
{% load static %} {% load static %}
{% block title %}Add New Book{% endblock %} {% block title %}Add New Book{% endblock %}
<form method = "POST">
{% csrf_token % }
{% for field in form%} {% block content %}
{% endform %} <form method = "POST">
{% csrf_token % }
{{ form.as_p }}
<input type = "submit" value = "Add Book" /> <input type = "submit" value = "Add Book" />
</form> </form>
{% block content %}
{% endblock %} {% endblock %}
...@@ -3,6 +3,7 @@ from django.views import View ...@@ -3,6 +3,7 @@ from django.views import View
from django.views.generic.list import ListView from django.views.generic.list import ListView
from django.views.generic.detail import DetailView from django.views.generic.detail import DetailView
from .models import Author, Books from .models import Author, Books
from django.views.generic.edit import CreateView, UpdateView
# Create your views here. # Create your views here.
...@@ -23,4 +24,10 @@ class AuthorListView(ListView): ...@@ -23,4 +24,10 @@ class AuthorListView(ListView):
class AuthorDetailView(DetailView): class AuthorDetailView(DetailView):
model = Author model = Author
template_name = 'bookshelf/author_details.html' template_name = 'bookshelf/author_details.html'
\ No newline at end of file
class BookCreateView(CreateView):
model = Book
fields = "__all__"
template_name = 'bookshelf/add-book.html'
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