Beispiel #1
0
def dashboard():
    """Dashboard."""
    form = LoginForm(request.form)
    # Handle logging in
    if request.method == 'POST':
        if form.validate_on_submit():
            login_user(form.user)
            flash('You are logged in.', 'success')
            redirect_url = (request.args.get('next')
                            or url_for('dashboard.dashboard'))
            return redirect(redirect_url)
        else:
            flash_errors(form)
    players = Player.query.all()
    games = Game.query.all()
    return render_template('dashboard/dashboard.html',
                           login_form=form,
                           players=players,
                           games=games,
                           episode_stats=Game.episode_stats())
Beispiel #2
0
def get_player(player_id):
    """Get game history and statistics for player."""
    form = LoginForm(request.form)
    # Handle logging in
    if request.method == 'POST':
        if form.validate_on_submit():
            login_user(form.user)
            flash('You are logged in.', 'success')
            redirect_url = request.args.get('next') or url_for('public.home')
            return redirect(redirect_url)
        else:
            flash_errors(form)

    player = Player.get_by_id(player_id)

    return render_template('dashboard/player.html',
                           player=player,
                           episode_stats=player.episode_stats(),
                           season_stats=player.season_stats(),
                           league_stats=player.league_stats(),
                           login_form=form)