def AddAuthorSuccess(request): if request.POST: author = Author() author = Author(AuthorID = request.POST["AuthorID"], name = request.POST["name"], age = request.POST["age"], Country = request.POST["Country"]) author.save() return render_to_response('AddAuthorSuccess.html',{'Name':author.name}) else: return render_to_response('AddAuthor.html')
def addauthor(req,authorid): name=req.GET.get('name') age=req.GET.get('age') country=req.GET.get('country') i=Author(AuthorID=authorid,Name=name,Age=age,Country=country) i.save() page=Book.objects.all() book_list=play(page) return render(req,'sucess.html',{})
def insertAuthor(request): if request.POST: post = request.POST new_author = Author( AuthorID = post["AuthorID"], Name = post.get('_AuthorName',False), Age = post["Age"], Country = post["Country"] ) new_author.save() new_book = Book( ISBN = post.get('ISBN',False), Title = post.get('Title',False), AuthorID = new_author, Publisher = post.get('Publisher',False), PublishDate = post.get('PublishDate',False), Price = post.get('Price',False) ) new_book.save() return HttpResponseRedirect("/book/") return render_to_response("insertAuthor.html")