def adb(request): p = Book() p.ISBN = request.GET.get('I','') p.Title = request.GET.get('T','') p.AuthorID = request.GET.get('ID','') p.Publisher = request.GET.get('Per','') p.PublishDate = request.GET.get('PD','') p.Price = request.GET.get('Price','') Author_list = Author.objects.all() for i in Author_list: if i.AuthorID == p.AuthorID: p.save() return render_to_response('adbresult.html') p.save() return render_to_response('adauthor.html',{'ID':p.AuthorID})