本文整理汇总了Python中models.Ticket.all方法的典型用法代码示例。如果您正苦于以下问题:Python Ticket.all方法的具体用法?Python Ticket.all怎么用?Python Ticket.all使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Ticket
的用法示例。
在下文中一共展示了Ticket.all方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import all [as 别名]
def get(self,code):
session = get_current_session()
code = helper.parse_post_id(code)
if session.has_key('error'):
error = session['error']
ticket = Ticket.all().filter('code',code).filter('is_active',True).fetch(1)
if len(ticket) == 1:
ticket = ticket[0]
self.response.out.write(template.render('templates/new-password.html', locals()))
else:
self.redirect('/')
示例2: post
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import all [as 别名]
def post(self,code):
session = get_current_session()
code = helper.parse_post_id(helper.sanitizeHtml(self.request.get('code')))
password = helper.sanitizeHtml(self.request.get('password'))
password_confirm = helper.sanitizeHtml(self.request.get('password_confirm'))
if password != password_confirm :
session['error'] = "Ocurrió un error al confirmar el password"
self.redirect('/recovery/'+code)
return
ticket = Ticket.all().filter('code',code).filter('is_active',True).fetch(1)
if len(ticket) == 1:
ticket = ticket[0]
user = ticket.user
user.password = User.slow_hash(password)
user.put()
ticket.is_active = False
ticket.put()
session['success'] = "Se ha cambiado el password correctamente, ya puedes iniciar sesión con tus nuevas credenciales"
self.redirect('/login')
else:
self.redirect('/')
示例3: get_tickets
# 需要导入模块: from models import Ticket [as 别名]
# 或者: from models.Ticket import all [as 别名]
def get_tickets():
tickets = Ticket.all()
return render_template("tickets.html", tickets=tickets)