本文整理匯總了Python中models.Transaction.date_end方法的典型用法代碼示例。如果您正苦於以下問題:Python Transaction.date_end方法的具體用法?Python Transaction.date_end怎麽用?Python Transaction.date_end使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類models.Transaction
的用法示例。
在下文中一共展示了Transaction.date_end方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_transaction
# 需要導入模塊: from models import Transaction [as 別名]
# 或者: from models.Transaction import date_end [as 別名]
def create_transaction():
''' Creates a transaction for the user's shopping cart. Apparently, adding
relations to transient transactions somehow automatically adds them to the
current session. As we usually don't want to commit semi-complete
transactions, DB modifications are prepent with session.rollback(). '''
ta = Transaction()
lending = session_or_empty('lend')
buying = session_or_empty('buy')
ta.group = session_or_empty('group')
if ta.group == []:
ta.group = 'int'
for id in lending:
item = Item.query.get(id)
ta.lend[id] = Lend(item, lending[id])
for id in buying:
item = Item.query.get(id)
ta.buy[id] = Buy(item, buying[id])
ta.date_start = session_or_empty('date_start')
ta.date_end = session_or_empty('date_end')
ta.name = session_or_empty('name')
ta.email = session_or_empty('email')
ta.tel = session_or_empty('tel')
g.ta = ta