本文整理汇总了Python中models.Request.status方法的典型用法代码示例。如果您正苦于以下问题:Python Request.status方法的具体用法?Python Request.status怎么用?Python Request.status使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Request
的用法示例。
在下文中一共展示了Request.status方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post
# 需要导入模块: from models import Request [as 别名]
# 或者: from models.Request import status [as 别名]
def post(self):
user = self.user_model
location = cgi.escape(self.request.get("location")).strip().lower()
date = cgi.escape(self.request.get("date"))
r_time = cgi.escape(self.request.get("time"))
price = int(cgi.escape(self.request.get("price")))
food_type = cgi.escape(self.request.get("food_type")).strip().lower()
interest = cgi.escape(self.request.get("interest")).strip().lower()
# Convert date and time to datetime
format_date = str(date+ " " +r_time+":00.0")
start_time = datetime.datetime.strptime(format_date, "%Y-%m-%d %H:%M:%S.%f")
# Create request
request = Request()
request.sender = user.key
request.sender_name = user.username
request.location = location
request.start_time = start_time
request.creation_time = datetime.datetime.now() - datetime.timedelta(hours=8) #PST
request.price = abs(price)
request.food_type = food_type
request.interest = interest
request.status = "waiting for a bid"
request.put()
print "Added request to queue"
time.sleep(1)
self.redirect('/')