本文整理匯總了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")