예제 #1
0
def crearP():
    nombre = request.form['nom']
    apellido = request.form['apell']
    fn = request.form['fn']

    profesor = Profesor()
    profesor.setNombre(nombre)
    profesor.setApellido(apellido)
    fn_split = fn.split('-', 2)
    profesor.setFechaNac(int(fn_split[0]), int(fn_split[1]), int(fn_split[2]))

    profesor.insertProfesor()
    return redirect('/profesor/')
            op_prof = input("\nIngrese la opcion correspondiente: ")

            if int(op_prof) == 1:
                os.system("clear")
                nom = input("Ingrese el nombre del profesor: ")
                apell = input("Ingrese el apellido del profesor: ")
                fecha_nac = input("Ingrese la fecha de nacimiento del profesor (utilice '/'): ")

                nombre_completo = nom + " " + apell
                verif = Profesor().getProfesor(nombre_completo)

                if verif is False:
                    prof = Profesor()

                    prof.setNombre(nom)
                    prof.setApellido(apell)

                    fecha_nac_split = fecha_nac.split("/", 2)

                    prof.setFechaNac(int(fecha_nac_split[2]), int(fecha_nac_split[1]), int(fecha_nac_split[0]))

                    prof.insertProfesor()

                    print("\nSe ha creado el profesor correctamente.")
                    input("Presione cualquier tecla para continuar...")
                else:
                    print("El profesor ya existe.")
                    input("Presione cualquier tecla para continuar...")

            elif int(op_prof) == 2: