本文整理汇总了Python中books.models.Book.Title方法的典型用法代码示例。如果您正苦于以下问题:Python Book.Title方法的具体用法?Python Book.Title怎么用?Python Book.Title使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类books.models.Book
的用法示例。
在下文中一共展示了Book.Title方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: add
# 需要导入模块: from books.models import Book [as 别名]
# 或者: from books.models.Book import Title [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')
示例2: addbook
# 需要导入模块: from books.models import Book [as 别名]
# 或者: from books.models.Book import Title [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',)