本文整理汇总了Python中models.Book.get_conditions方法的典型用法代码示例。如果您正苦于以下问题:Python Book.get_conditions方法的具体用法?Python Book.get_conditions怎么用?Python Book.get_conditions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Book
的用法示例。
在下文中一共展示了Book.get_conditions方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import get_conditions [as 别名]
def get(self):
# Get all the displayable books
books_query = Book.query(ancestor=ROOT_BOOK_KEY)
# Get the books currently in the cart
cart_query = []
# check for a person and filter the books
if self.person:
books_query = books_query.filter(ndb.OR(Book.cart_key == None, Book.cart_key == self.person.key))
cart_query = self.person.get_cart()
else:
# remove all the books that are in someone's cart
books_query = books_query.filter(Book.cart_key == None)
books_query = books_query.order(-Book.last_touch_date_time)
# Get additional details needed to populate lists
dept_query = Department.query(ancestor=ROOT_DEPT_KEY).order(Department.abbrev)
book_conditions = Book.get_conditions()
self.values.update({"books_query": books_query,
"cart_query" : cart_query,
"dept_query": dept_query,
"book_conditions": book_conditions})
self.render(**self.values)