當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。