本文整理汇总了Python中models.Book.find方法的典型用法代码示例。如果您正苦于以下问题:Python Book.find方法的具体用法?Python Book.find怎么用?Python Book.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Book
的用法示例。
在下文中一共展示了Book.find方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: destroy
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import find [as 别名]
def destroy(id):
found_book = Book.find(id)
Book.book_list.remove(found_book)
return redirect(url_for('index'))
示例2: update
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import find [as 别名]
def update(id):
found_book = Book.find(id)
found_book.title = request.form['title']
found_book.author = request.form['author']
return redirect(url_for('index'))
示例3: show
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import find [as 别名]
def show(id):
return render_template('show.html', book = Book.find(id))
示例4: edit
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import find [as 别名]
def edit(id):
return render_template('edit.html', book = Book.find(id))
示例5: books
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import find [as 别名]
def books():
response.set_header('Content-Type', 'application/json')
prefix = get_prefix(request)
bks = [bk.to_json(prefix=prefix) for bk in Book.find()]
return '[' + ',\n'.join(bks) + ']'