本文整理汇总了Python中models.Movie.next_for_user方法的典型用法代码示例。如果您正苦于以下问题:Python Movie.next_for_user方法的具体用法?Python Movie.next_for_user怎么用?Python Movie.next_for_user使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Movie
的用法示例。
在下文中一共展示了Movie.next_for_user方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: movie
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import next_for_user [as 别名]
def movie():
return render_template('movie.html', movie=Movie.next_for_user(g.user))
示例2: decorated_function
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import next_for_user [as 别名]
def decorated_function(*args, **kwargs):
if not Movie.next_for_user(g.user):
return redirect(url_for('leaderboard'))
return func(*args, **kwargs)
示例3: answer
# 需要导入模块: from models import Movie [as 别名]
# 或者: from models.Movie import next_for_user [as 别名]
@require_login
def answer():
# Prevent user from guessing twice on the same movie
try:
guess = Guess.save(
request.form['guess'],
g.user.id,
request.form['movie']
)
except IntegrityError, e:
return 'Du har redan gissat på den här filmen', 403
return render_template(
'answer.html',
movie=guess.movie,
complete=(False if Movie.next_for_user(g.user) else True),
guess=guess
)
@app.route('/leaderboard', methods=['GET', 'POST'])
@identify_user
def leaderboard():
# Let user set their name
if request.method == 'POST' and g.user:
g.user.name = request.form['name']
g.user.update()
return render_template(
'leaderboard.html',
users=User.by_score(),