def addwriter(request): AUTHOR = Author() AUTHOR.AuthorID = request.POST['author_ID'] AUTHOR.Age = request.POST['author_age'] AUTHOR.Country = request.POST['author_country'] AUTHOR.Name = request.POST['author_name'] AUTHOR.save() AuthorList = Author.objects.all() return render_to_response('addbook.html')
def AddBook2(request): AUTHOR = Author() AUTHOR.AulthorID = request.POST['author_ID'] AUTHOR.Age = request.POST['author_age'] AUTHOR.Country = request.POST['author_country'] AUTHOR.Name = request.POST['author_name'] AUTHOR.save() BOOK = Book() BOOK.Title = request.POST['book_name'] BOOK.AulthorID_id = request.POST['author_ID'] BOOK.Publisher = request.POST['book_publisher'] BOOK.PublishDate = request.POST['book_date'] BOOK.Price = float(request.POST['book_price']) BOOK.save() BookList = Book.objects.all() return render_to_response('BookList.html',{'BookList':BookList})