42 lines
1.2 KiB
Python
42 lines
1.2 KiB
Python
# coding: utf-8
|
|
import requests
|
|
from flask import (
|
|
g, Blueprint, render_template, abort, current_app, redirect,
|
|
redirect, request, url_for, session, flash
|
|
)
|
|
from jinja2 import TemplateNotFound
|
|
from wotstats.openid import oid
|
|
|
|
from wotstats.log import log
|
|
from wotstats.database import db
|
|
from wotstats.models import User
|
|
from wotstats.lib import parse_wargaming_openid_url, get_player_personal_data, statistics as texts_statistics
|
|
|
|
pages_account = Blueprint(
|
|
'pages_account', __name__,
|
|
url_prefix='/account',
|
|
template_folder='templates'
|
|
)
|
|
|
|
|
|
@pages_account.route('/')
|
|
def index():
|
|
if not g.user:
|
|
return redirect(url_for('pages_home.index'))
|
|
|
|
user_id = parse_wargaming_openid_url(session['openid'])[0]
|
|
|
|
account_statistics = get_player_personal_data(
|
|
current_app.config['WG_APPLICATION_ID'], user_id
|
|
)
|
|
return render_template(
|
|
'pages/account/index.html',
|
|
account_statistics=account_statistics,
|
|
texts_statistics=texts_statistics)
|
|
|
|
|
|
@pages_account.route('/statistics.html')
|
|
def statistics():
|
|
if not g.user:
|
|
return redirect(url_for('pages_home.index'))
|
|
return render_template('pages/account/statistics.html')
|