本文整理汇总了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)
示例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
示例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)
示例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("")
示例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()