Esempio n. 1
0
def user_user_go(user):
    if user.get('going_%s' % app.config['YEAR'], False):
        return True
    else:
        user['going_%s' % app.config['YEAR']] = True
        create_update_profile(user, user['user_hash'])
        app.redis.zadd(KEYS['entrants'], user['user_hash'], int(time()))
        app.redis.incr(KEYS['entrant_count'])
        return False
Esempio n. 2
0
def user_user_go(user):
    if user.get("going_%s" % app.config["YEAR"], False):
        return True
    else:
        user["going_%s" % app.config["YEAR"]] = True
        create_update_profile(user, user["user_hash"])
        app.redis.zadd(KEYS["entrants"], user["user_hash"], int(time()))
        app.redis.incr(KEYS["entrant_count"])
        return False
Esempio n. 3
0
def user_user_go(user):
    if user.get('going', False):
        return True
    else:
        user['going'] = True
        create_update_profile(user, user['user_hash'])
        app.redis.zadd(KEYS['entrants'], user['user_hash'], int(time()))
        app.redis.incr(KEYS['entrant_count'])
        return False
Esempio n. 4
0
def login_settings():
    user = check_auth()
    if request.method == "POST":
        form = SettingsForm(request.form)
        if form.validate():
            create_update_profile(form.data, user['user_hash'])
            flash(u'Profil aktualizován', 'success')
            return redirect(url_for('login_settings'))
    else:
        form = SettingsForm(**user)
    return render_template('nastaveni.html', user=user, form=form)
Esempio n. 5
0
def login_settings():
    user = check_auth()
    if request.method == "POST":
        form = SettingsForm(request.form)
        if form.validate():
            create_update_profile(form.data, user['user_hash'])
            flash(u'Profil aktualizován', 'success')
            return redirect(url_for('login_settings'))
    else:
        form = SettingsForm(**user)
    return render_template('nastaveni.html', user=user, form=form)
Esempio n. 6
0
def attend_remove():
    user = check_auth()
    if not user.get("going_%s" % app.config["YEAR"], False):
        flash(u"Na akci jsi doposud nebyl přihlášen", "warning")
    else:
        user["going_%s" % app.config["YEAR"]] = False
        create_update_profile(user, user["user_hash"])
        app.redis.zrem(KEYS["entrants"], user["user_hash"])
        app.redis.decr(KEYS["entrant_count"])
        remove_user_votes(user["user_hash"])
        flash(u"Již nejsi přihlášen na akci", "success")
    return redirect(url_for("index"))  # , _anchor="entrants"))
Esempio n. 7
0
def attend_remove():
    user = check_auth()
    if not user.get('going_%s' % app.config['YEAR'], False):
        flash(u'Na akci jsi doposud nebyl přihlášen', 'warning')
    else:
        user['going_%s' % app.config['YEAR']] = False
        create_update_profile(user, user['user_hash'])
        app.redis.zrem(KEYS['entrants'], user['user_hash'])
        app.redis.decr(KEYS['entrant_count'])
        remove_user_votes(user['user_hash'])
        flash(u'Již nejsi přihlášen na akci', 'success')
    return redirect(url_for('index'))  # , _anchor="entrants"))
Esempio n. 8
0
def attend_remove():
    user = check_auth()
    if not user.get('going', False):
        flash(u'Na akci jsi doposud nebyl přihlášen', 'warning')
    else:
        user['going'] = False
        create_update_profile(user, user['user_hash'])
        app.redis.zrem(KEYS['entrants'], user['user_hash'])
        app.redis.decr(KEYS['entrant_count'])
        remove_user_votes(user['user_hash'])
        flash(u'Již nejsi přihlášen na akci', 'success')
    return redirect(url_for('index'))  # , _anchor="entrants"))