Ejemplo n.º 1
0
def add_user():
    if request.method == 'POST':
        DbUtils.insert_user(request.form['login'], request.form['password'],
                            request.form['email'], request.form['user_type'],
                            request.form['full_name'])
        users = DbUtils.select_users()
        return render_template('manage_users.html',
                               users=users,
                               len=len(users),
                               login=app.config['USER'].login,
                               type=app.config['USER'].type)
    return render_template('add_user.html',
                           login=app.config['USER'].login,
                           type=app.config['USER'].type)
Ejemplo n.º 2
0
def registration():
    if request.method == 'POST':
        DbUtils.insert_user(request.form['login'], request.form['password'],
                            request.form['email'], request.form['user_type'],
                            request.form['full_name'])
        tmp = DbUtils.select_user_full(request.form['login'])
        app.config['USER'] = User(tmp[0][0], tmp[0][1], tmp[0][2], tmp[0][3],
                                  tmp[0][4])
        products = Utils.get_prod_units()
        return render_template('buy_prod_units.html',
                               products=products,
                               len_p=len(products),
                               login=app.config['USER'].login)

    return render_template('registration.html')