示例#1
0
文件: viewfu.py 项目: chengpx/money
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")
示例#2
0
文件: viewfu.py 项目: chengpx/money
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")
示例#3
0
文件: views.py 项目: chengpx/money
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")