def bot_page(username, botname): user = session.query(User).filter_by(nickname=username).one_or_none() if user is None: flash('User {} does not exist.') return redirect(url_for('users')) bot = session.query(Bot).filter_by(user=user, name=botname).one_or_none() if bot is None: flash('{} does not exist or does not belong to {}' .format(botname, username)) return redirect(url_for('user_page', username=username)) paginated_bot_participations_ = paginate(bot.participations.order_by( desc(MatchParticipation.match_id) )) return render_template( 'bots/bot.html', bot=bot, paginated_bot_participations=paginated_bot_participations_)
def bot_page(username, botname): user = session.query(User).filter_by(nickname=username).one_or_none() if user is None: flash('User {} does not exist.') return redirect(url_for('users')) bot = session.query(Bot).filter_by(user=user, name=botname).one_or_none() if bot is None: flash('{} does not exist or does not belong to {}'.format( botname, username)) return redirect(url_for('user_page', username=username)) paginated_bot_participations_ = paginate( bot.participations.order_by(desc(MatchParticipation.match_id))) return render_template( 'bots/bot.html', bot=bot, paginated_bot_participations=paginated_bot_participations_)
def matches(): matches_ = session.query(Match).order_by(desc(Match.id)) paginated_matches_ = paginate(matches_) return render_template('matches.html', paginated_matches=paginated_matches_)