本文整理汇总了Python中models.Book.first方法的典型用法代码示例。如果您正苦于以下问题:Python Book.first方法的具体用法?Python Book.first怎么用?Python Book.first使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Book
的用法示例。
在下文中一共展示了Book.first方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import first [as 别名]
def post(self):
book = Book()
book.rating = self.request.get('rating')
book.title = self.request.get('title')
book.summary = self.request.get('summary') if self.request.get('summary') != book.summary else book.summary
book.first = self.request.get('first') if self.request.get('first') != book.first else book.first
book.second = self.request.get('second') if self.request.get('second') != book.second else book.second
book.third = self.request.get('third') if self.request.get('third') != book.third else book.third
book.notes = self.request.get('notes') if self.request.get('notes') != book.notes else book.notes
if book.amazon_link != db.Link(self.request.get('amazon')):
book.amazon_link = db.Link(self.request.get('amazon'))
book.url = (self.request.path).lstrip('/edit')
book.put()
self.redirect('/%s' % book.url)
示例2: post
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import first [as 别名]
def post(self):
book = Book()
book.rating = self.request.get('rating')
book.title = self.request.get('title')
book.summary = self.request.get('summary')
book.first = self.request.get('first')
book.second = self.request.get('second')
book.third = self.request.get('third')
book.notes = self.request.get('notes')
book.amazon_link = db.Link(self.request.get('amazon'))
book.url = self.request.get('title').replace(' ', '').lower()
# book.url = string.translate(url,string.maketrans('',''), string.punctuation)
# cover = self.request.get('img')
book.cover = self.request.get('img')
book.put()
self.redirect('/')