def add_author(request): post = request.POST if post:#getting the form of a new author newauthor = Author( Name=post.get('Name', ''), Age=post.get('Age', ''), Country=post.get('Country', ''), ) newauthor.save() return render(request, 'add_author.html', {})
def Add(request): a=request.GET['a'] b=request.GET['b'] c=request.GET['c'] d=request.GET['d'] e=request.GET['e'] f=request.GET['f'] g=request.GET['g'] h=request.GET['h'] i=request.GET['i'] t= Author(AuthorID=a,Name=b,Age=c,Country=d) t.save() p=Book(ISBN=e,Title=f,AuthorID=t,Publisher=g,PublishDate=h,Price=i) p.save() return render_to_response('Add_result.htm')