Exemplo n.º 1
0
def update_book(request):
    if request.POST:
        post=request.POST
        new_book = Book(
            title = post["textfield"],
            authorID  = post["textfiel2"], 
            publisher = post["textfield3"],
            publishdate = post["textfield4"],
            price = post["textfield5"],
            )
        new_book.save()
    return render_to_response("update_book.html")
Exemplo n.º 2
0
def add_book(request):
    if request.POST:
        post=request.POST
        new_book = Book(
            isbn = post["textfield"],
            title = post["textfield2"],
            authorID = post["textfield3"],
            publisher = post["textfield4"],
            publishdate = post["textfield5"],
            price = post["textfield6"],
            )
        new_book.save()
        return render_to_response("add_book.html")
    else:
        return HttpResponse("hHH")
Exemplo n.º 3
0
def insert_book(request):
    if request.POST:
        post=request.POST
        new_book = Book(
            isbn = post["textfield"],
            title = post["textfield2"],
            authorID = post["textfield3"],
            publisher = post["textfield4"],
            publishdate = post["textfield5"],
            price = post["textfield6"],
            )
        new_book.save()
        auth = Author.objects.filter(authorID=new_book.authorID)
        if len(auth)==0:
            return render_to_response("add_author.html")
        else:
            return render_to_response("insert_book.html")