当前位置: 首页>>代码示例>>Python>>正文


Python Ticket.get方法代码示例

本文整理汇总了Python中models.Ticket.get方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.get方法的具体用法?Python Ticket.get怎么用?Python Ticket.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Ticket的用法示例。


在下文中一共展示了Ticket.get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: on_pay_clicked

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import get [as 别名]
 def on_pay_clicked(self,widget,data=None):
     id = self.serial_number.get_text()
     ticket = Ticket.get(id=id)
     ticket.paid = True
     ticket.paidDate = datetime.now()
     ticket.save()
     self.serial_number.set_text("")
     self.validity_label.set_text("")
     self.pay.set_sensitive(False)
开发者ID:Okiria,项目名称:betting,代码行数:11,代码来源:bet_interface.py

示例2: verify

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import get [as 别名]
def verify(ticket_id):
    try:
        ticket = Ticket.get(id = ticket_id)
        if ticket.has_won():
            return ticket
        else:
            return None
    except Ticket.DoesNotExist:
        return None
开发者ID:Okiria,项目名称:betting,代码行数:11,代码来源:api.py

示例3: on_serial_number_changed

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import get [as 别名]
 def on_serial_number_changed(self,widget,data=None):
     id = self.serial_number.get_text()
     if id != "":
         try:
             ticket = Ticket.get(id=id,branch=1)
             self.validity_label.set_text("Available")
             self.verify_serial.set_sensitive(True)
         except Ticket.DoesNotExist:
             self.validity_label.set_text("Invalid")
             self.verify_serial.set_sensitive(False)
     else:
         self.verify_serial.set_sensitive(False)
开发者ID:Okiria,项目名称:betting,代码行数:14,代码来源:bet_interface.py

示例4: on_verify_serial_clicked

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import get [as 别名]
 def on_verify_serial_clicked(self,widget,data=None):
     id = self.serial_number.get_text()
     try:
         ticket = Ticket.get(id=id,branch=1)
         if ticket.is_winner():
             if not ticket.paid:
                 self.validity_label.set_text(str(ticket.expectedAmount))
                 self.pay.set_sensitive(True)
             else:
                 self.validity_label.set_text("Already payed")
                 self.pay.set_sensitive(False)
                 self.serial_number.set_text("")
         else:
             self.validity_label.set_text("Ticket Lost")
             self.pay.set_sensitive(False)
             self.serial_number.set_text("")
     except Ticket.DoesNotExist:
         self.validity_label.set_text("Invalid Ticket")
         self.pay.set_sensitive(False)
         self.serial_number.set_text("")
开发者ID:Okiria,项目名称:betting,代码行数:22,代码来源:bet_interface.py

示例5: done_paying

# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import get [as 别名]
def done_paying(ticket_id):
    ticket = Ticket.get(id=ticket_id)
    amount = ticket.amount
    ticket.delete_instance()
开发者ID:Okiria,项目名称:betting,代码行数:6,代码来源:api.py


注:本文中的models.Ticket.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。