本文整理汇总了Python中models.Transaction.date_start方法的典型用法代码示例。如果您正苦于以下问题:Python Transaction.date_start方法的具体用法?Python Transaction.date_start怎么用?Python Transaction.date_start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Transaction
的用法示例。
在下文中一共展示了Transaction.date_start方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_transaction
# 需要导入模块: from models import Transaction [as 别名]
# 或者: from models.Transaction import date_start [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