本文整理汇总了Python中models.Ticket.create方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.create方法的具体用法?Python Ticket.create怎么用?Python Ticket.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Ticket
的用法示例。
在下文中一共展示了Ticket.create方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: post_tickets
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import create [as 别名]
def post_tickets():
ticket_form = request.form.to_dict()
new_ticket = Ticket.create(ticket_form)
if not new_ticket:
return json.dumps({
'error': "couldn't add ticket"
}), 422
return json.dumps({
'ticket': new_ticket
}), 200
示例2: on_stakeButton_clicked
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import create [as 别名]
def on_stakeButton_clicked(self,widget,data=None):
self.fullTicket = Ticket.create(amount = self.amountstaked.get_text(),betOn=datetime.now())
if len(self.bets) < 0:
#Todo make sure no empty bets are made
pass
else:
for bet in self.bets:
bet.ticket = self.fullTicket
bet.save()
self.totalstake.set_text(str(self.amountstaked.get_text()))
self.exAmount.set_text(str(self.fullTicket.expectedAmount))
self.totalOdd.set_text(str(self.fullTicket.totalOdds))
self.confirmVbox.show()
self.stakebox.hide()
self.enterbet_box.hide()
self.payment_box.hide()
self.bet_box.hide()
self.anothermatch_label.hide()