Exemple #1
0
def CreateUser():
    if request.method == 'GET':
        return render_template("CreateUserForm.html")
    else:
        user = request.form["user"]
        name = request.form["nombre"]
        apellido = request.form["apellido"]
        password = request.form["password"]
        correo = request.form["correo"]
        carnet = request.form["carnet"]
        carrera = request.form["carrera"]
        anio = request.form["anio"]
        tipo = request.form["rol"]
        logic = UserLogic()
        rows = logic.InsertUser(carnet, user, name, apellido, password, correo,
                                carrera, anio, tipo)
        print(f" {rows} affected")
        return redirect("/loginform/createuser")
Exemple #2
0
def Usuarios():
    if request.method == "GET":
        database = UserLogic()
        data = database.getUsuarios()
        return render_template("Usuarios_admin.html", Usuarios=data)
    if request.method == 'POST':
        database = UserLogic()
        user = request.form["user"]
        name = request.form["nombre"]
        apellido = request.form["apellido"]
        password = request.form["password"]
        correo = request.form["correo"]
        carnet = request.form["carnet"]
        carrera = request.form["carrera"]
        anio = request.form["anio"]
        tipo = request.form["rol"]
        rows = database.InsertUser(carnet, user, name, apellido, password,
                                   correo, carrera, anio, tipo)
        print(rows)
        return redirect("/MainSiteAdmin/Usuarios")