Commit b2da419a authored by Ysabella Panghulan's avatar Ysabella Panghulan

fixed BooksCreateView class

parent 2925119d
......@@ -5,7 +5,7 @@ from django.shortcuts import render, redirect
from django.views.generic.list import ListView
from django.views.generic.detail import DetailView
from django.views.generic.edit import CreateView
from .forms import AuthorForm
from .forms import AuthorForm, BookForm
# Create your views here.
def Homepage(request):
......@@ -33,10 +33,10 @@ class BooksCreateView(CreateView):
def post(self, request, *args, **kwargs):
form = BookForm(request.POST)
if form.is_valid():
author = form.save()
book = form.save()
return redirect('book-details', pk=book.pk)
else:
form = AuthorForm()
form = BookForm()
context = {
'form': form
}
......
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