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


Python Book.get_conditions方法代码示例

本文整理汇总了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)
开发者ID:fanghuang,项目名称:Booksharepoint,代码行数:27,代码来源:main_handlers.py


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