def update_user(): if request.method == 'POST': password = request.form['password'] password_hash = "" if password == "": password_hash = "" else: password_hash = generate_password_hash(request.form['password']) DbUtils.update_user(request.form['id'], request.form['login'], password_hash, 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) 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)
def edit_user(): if request.method == 'POST': action_type = request.form['submit'] if action_type == "Удалить": DbUtils.delete_user(request.form['id']) 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) elif action_type == "Изменить": return render_template('edit_user.html', id=request.form['id'], login2=request.form['login'], email=request.form['email'], full_name=request.form['full_name'], user_type=request.form['user_type'], login=app.config['USER'].login, type=app.config['USER'].type) return render_template('edit_user.html', login=app.config['USER'].login, type=app.config['USER'].type)
def manage_users(): 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)
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)