当前位置: 首页>>代码示例>>Python>>正文


Python Book.Price方法代码示例

本文整理汇总了Python中books.models.Book.Price方法的典型用法代码示例。如果您正苦于以下问题:Python Book.Price方法的具体用法?Python Book.Price怎么用?Python Book.Price使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在books.models.Book的用法示例。


在下文中一共展示了Book.Price方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add

# 需要导入模块: from books.models import Book [as 别名]
# 或者: from books.models.Book import Price [as 别名]
def add(request):
    book_list = Book()
    if request.POST:
        book_list.ISBN = request.POST['ISBN']
        book_list.Title = request.POST['Title']
        book_list.AuthorID = request.POST['AuthorID']
        book_list.Publisher = request.POST['Publisher']
        book_list.PublishDate = request.POST['PublishDate']
        book_list.Price = request.POST['Price']
        author_id = book_list.AuthorID
        book_list.save()
        try:
            author = Author.objects.get(AuthorID = author_id)
            return render_to_response('add_Successed.html')
        except:     
            return render(request,'needauthor.html')
    else:
        return render(request,'add.html')
开发者ID:hongkailun,项目名称:123,代码行数:20,代码来源:views.py

示例2: addbook

# 需要导入模块: from books.models import Book [as 别名]
# 或者: from books.models.Book import Price [as 别名]
def addbook(request):
    if request.POST:
        name = request.POST['name']
        try:
            author = Author.objects.get(Name=name)
        except:
            return render_to_response('addau.html',)

        else:
            book = Book()
            book.AuthorID = author 
            book.Publisher = request.POST['publisher']
            book.Title = request.POST['title']
            book.PublishDate = request.POST['publishdate']
            book.Price = request.POST['price']
            book.save()
            books = Book.objects.all()
            authors = Author.objects.all()
            return render_to_response('home.html',locals())
    else:
        return render_to_response('addbook.html',)
开发者ID:OA1366,项目名称:sq,代码行数:23,代码来源:view.py


注:本文中的books.models.Book.Price方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。