Esempio n. 1
0
def list_by_year(year):
    user_id = users.current_user_id()

    if not user_id:
        return flask.redirect(flask.url_for('index'))

    all_logs = logs.list_by_year(user_id, year)

    return flask.render_template('list.html', logs=all_logs)
Esempio n. 2
0
def edit_log(log_id):
    user_id = users.current_user_id()

    if not user_id:
        return flask.redirect(flask.url_for('index'))

    log = logs.read_log(user_id, log_id)

    return flask.render_template('log.html', log=log)
Esempio n. 3
0
def import_logs_form():
    current_user_id = users.current_user_id()

    json_data = json.loads(flask.request.form.get('import_data'))

    for game in json_data.get('games', []):
        log_data = {}
        log_data.update(game)
        log_data.update({
            "game_name": game['name'],
            "tags": tags.as_string(game['tags']),
        })
        logs.log(current_user_id, log_data)

    return flask.redirect(flask.url_for('logs_listing'))
Esempio n. 4
0
def log_form():
    app.logger.info(flask.request.form)
    logs.log(users.current_user_id(), flask.request.form)
    return flask.redirect(flask.url_for('home'))
Esempio n. 5
0
def edit_log_form(log_id):
    user_id = users.current_user_id()
    logs.update_log(user_id, log_id, flask.request.form)
    return flask.redirect(flask.url_for('show_log', log_id=log_id))
Esempio n. 6
0
def delete_log_form(log_id):
    user_id = users.current_user_id()
    logs.delete_log(user_id, log_id, unconditional_delete=True)
    return flask.redirect(flask.url_for('logs_listing'))