本文整理汇总了Python中models.Book.book_in_series方法的典型用法代码示例。如果您正苦于以下问题:Python Book.book_in_series方法的具体用法?Python Book.book_in_series怎么用?Python Book.book_in_series使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Book
的用法示例。
在下文中一共展示了Book.book_in_series方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Book [as 别名]
# 或者: from models.Book import book_in_series [as 别名]
def post(self):
user = users.get_current_user()
if user:
# gather ip the pieces of data
bookshelf_name = user.nickname()
book = Book(parent=bookshelf_key(bookshelf_name))
book.username = user.nickname()
book.title = self.request.get('title')
book.author = self.request.get('author')
if self.request.get('in_series') == constants.CHECKED:
book.in_series = True
else:
book.in_series = False
book.series_name = self.request.get('series_name')
try:
book.book_in_series = int(self.request.get('book_in_series'))
except:
book.book_in_series = None
book.isbn = self.request.get('isbn')
try:
book.pub_year = int(self.request.get('pub_year'))
except:
book.pub_year = None
if self.request.get('was_it_read') == constants.CHECKED:
book.was_read = True
else:
book.was_read = False
try:
cdt = datetime.strptime(self.request.get('date_read'), '%m/%d/%Y')
cd = date(cdt.year, cdt.month, cdt.day)
book.completed_date = cd
except Exception, e:
logging.info("exception getting read date : " + str(e))
book.completed_date = None
book.put()
self.redirect('/books')