本文整理汇总了Python中models.Transaction.get_by_id方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.get_by_id方法的具体用法?Python Transaction.get_by_id怎么用?Python Transaction.get_by_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Transaction
的用法示例。
在下文中一共展示了Transaction.get_by_id方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_trans_id
# 需要导入模块: from models import Transaction [as 别名]
# 或者: from models.Transaction import get_by_id [as 别名]
def get_trans_id():
while True:
code_id = ''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(5))
trans = Transaction.get_by_id(code_id)
if not trans:
break
return code_id
示例2: get
# 需要导入模块: from models import Transaction [as 别名]
# 或者: from models.Transaction import get_by_id [as 别名]
def get(self):
if not self.request.get("trans_id"):
self.tv["current_page"] = "TRANSACTION"
self.tv["trans_id"] = get_trans_id()
self.render("frontend/transactionpage.html")
return
self.tv["current_page"] = "TRANSACTION DETAILS"
trans_id = self.request.get("trans_id")
trans = Transaction.get_by_id(trans_id)
parcel = P.query(P.trans_key == trans.key.urlsafe()).fetch(1)
self.tv["parcel_code"] = parcel[0].codes
self.tv["transaction"] = trans.to_object()
self.render("frontend/trans-details.html")