def crearSesion(self, fecha, hora_inicio, hora_final, materia): cursor = mysql.get_db().cursor() cursor.execute( "INSERT into calendario.sesiones(fecha,hora_inicio,hora_final, asignatura) values(%s, %s, %s,%s)", (fecha, hora_inicio, hora_final, materia)) mysql.get_db().commit() cursor.close()
def editarSpaceAcadem(self, id, nombre, semestre): cursor = mysql.get_db().cursor() cursor.execute( "UPDATE espacioacd set nombre=%s, semestre=%s where idespacioacd=%s", (nombre, semestre, id)) mysql.get_db().commit() cursor.close()
def editarSesion(self, id, fecha, hora_inicio, hora_final): cursor = mysql.get_db().cursor() cursor.execute( "UPDATE sesiones SET fecha =%s, hora_inicio = %s, hora_final=%s where idsesiones=%s", (fecha, hora_inicio, hora_final, id)) mysql.get_db().commit() cursor.close()
def sesionEtudiane(self, idsesion, i, falta): cursor = mysql.get_db().cursor() cursor.execute( "INSERT into calendario.sesion_estudiantes(idsesion,idestudiante,asistencia) values (%s,%s,%s)", (idsesion, i, falta)) mysql.get_db().commit() cursor.close()
def editarEstudianteMateria(self, idstude, asistencia): cursor = mysql.get_db().cursor() cursor.execute( "UPDATE calendario.sesion_estudiantes set asistencia = %s WHERE idestudiante = %s", (asistencia, idstude)) print("mysql:", idstude, asistencia) mysql.get_db().commit() cursor.close()
def update_student(self, id_, cc, nombre, apellido, celular, correo): cursor = mysql.get_db().cursor() cursor.execute( 'UPDATE estudiantes SET identificacion=%s, nombre=%s, apellido=%s, celular=%s, correo=%s WHERE idestudent=%s', (cc, nombre, apellido, celular, correo, id_)) estudiantes = cursor.fetchall() mysql.get_db().commit() cursor.close()
def agregar_alumno(self, cc, nombre, apellido, celular, email, semestre, materia): cursor = mysql.get_db().cursor() cursor.execute( 'insert into estudiante(cc, nombre, apellido, celular, email, semestre,materia) values(%s,%s,%s,%s,%s,%s,%s)', (cc, nombre, apellido, celular, email, semestre, materia)) mysql.get_db().commit() cursor.close()
def crearEstudiante(self, cc, nombre, apellido, celular, correo, semestre, espacioacd): cursor = mysql.get_db().cursor() cursor.execute( """insert into estudiantes(identificacion,nombre,apellido,celular,correo,semestre,idespacioacd) values(%s,%s,%s,%s,%s,%s,%s) """, (cc, nombre, apellido, celular, correo, semestre, espacioacd)) mysql.get_db().commit() cursor.close()
def update_materia(id): if request.method == 'POST': materia = request.form['name'] semester = request.form['semester'] cur = mysql.get_db().cursor() cur.execute( """ UPDATE materias SET name = %s, semester = %s WHERE id = %s """, (materia, semester, id)) flash('Operacion ¡Exitosa!') mysql.get_db().commit() return redirect(url_for('materias'))
def id_sesion(self, id): cursor = mysql.get_db().cursor() cursor.execute("SELECT * FROM calendario.sesiones WHERE idsesiones=%s", (id)) id_sesions = cursor.fetchall() cursor.close() return id_sesions
def editar_session(self, id): cur = mysql.get_db().cursor() cur.execute("SELECT * FROM session WHERE id=%s",(id,)) data = cur.fetchall() cur.close() return data
def listar_space_ID(self, id): cursor = mysql.get_db().cursor() cursor.execute( "SELECT * FROM calendario.espacioacd where idespacioacd=%s", (id)) espaciosAcademicosid = cursor.fetchall() cursor.close() return espaciosAcademicosid
def get_materia(id): cur = mysql.get_db().cursor() cur.execute("SELECT * FROM materias WHERE id=%s", (id, )) data = cur.fetchall() cur.close() print(data[0]) return render_template('estudiantes/actualizar_materia.html', materia=data[0])
def idespacioAcadem(self, espacio): cursor = mysql.get_db().cursor() cursor.execute( "SELECT idespacioacd FROM calendario.espacioacd where nombre=%s", (espacio)) idespacio = cursor.fetchone() cursor.close() return idespacio
def idsesion(self): cursor = mysql.get_db().cursor() cursor.execute( "SELECT idsesiones FROM calendario.sesiones ORDER by idsesiones DESC LIMIT 1" ) sesiones = cursor.fetchone() cursor.close() return sesiones
def idAllstudiantes(self, materia): cursor = mysql.get_db().cursor() cursor.execute( """SELECT idestudent FROM calendario.estudiantes,calendario.espacioacd WHERE estudiantes.idespacioacd=espacioacd.idespacioacd and espacioacd.nombre=%s""", (materia)) idAllestudiantes = cursor.fetchall() cursor.close() return idAllestudiantes
def estudianteListMateria(self, idsesion): cursor = mysql.get_db().cursor() cursor.execute( """ select idestudent,identificacion,nombre,apellido,celular,asistencia from calendario.estudiantes,calendario.sesiones,calendario.sesion_estudiantes where idsesion=idsesiones and idestudiante=idestudent and idsesion=%s""", (idsesion)) estudianteMateria = cursor.fetchall() cursor.close() return estudianteMateria
def get_student(self, id_): cursor = mysql.get_db().cursor() cursor.execute( "SELECT * FROM estudiantes where estudiantes.idestudent=" + str(id_)) estudiante = cursor.fetchall() cursor.close() return estudiante
def listarEstudiantes(self): cursor = mysql.get_db().cursor() cursor.execute(""" SELECT estudiantes.idestudent, estudiantes.identificacion, estudiantes.nombre, estudiantes.apellido, estudiantes.celular, estudiantes.correo, estudiantes.semestre, espacioacd.nombre FROM calendario.estudiantes,espacioacd where estudiantes.idespacioacd=espacioacd.idespacioacd """) estudiantes = cursor.fetchall() cursor.close() print(estudiantes) return estudiantes
def editar_estudiante(self): cursor = mysql.get_db().cursor() cursor.execute("select * from estudiante WHERE id=%s", (id, )) data = cursor.fetchone() cursor.close() return data
def mostrar_estudiantes(self): cursor = mysql.get_db().cursor() cursor.execute('select * from estudiante') data = cursor.fetchall() cursor.close() return data
def delete_materia(id): cur = mysql.get_db().cursor() cur.execute('DELETE FROM materias WHERE id = {0}'.format(id)) mysql.get_db().commit() flash('Asignatura Eliminada Satisfactoriamente') return redirect(url_for('materias'))
def listarUser(self): cursor = mysql.get_db().cursor() cursor.execute('select * from persona') usuarios = cursor.fetchall() cursor.close() return usuarios
def update(self,id,nombre,apellido,celular,correo,contrasena): cursor = mysql.get_db().cursor() cursor.execute('update persona set nombre = %s, apellido = %s, celular = %s,correo = %s, contrasena = %s WHERE idpersona=%s',(nombre,apellido, celular, correo, contrasena, id)) mysql.get_db().commit() cursor.close()
def crearUser(serlf,nombre,apellido,celular,correo,contrasena): cursor = mysql.get_db().cursor() cursor.execute('insert into persona(nombre,apellido,celular,correo,contrasena) values(%s,%s,%s,%s,%s)', (nombre,apellido, celular, correo, contrasena)) mysql.get_db().commit() cursor.close()
def listarTablas(self): cursor = mysql.get_db().cursor() cursor.execute('DESCRIBE flask_mvc') database = cursor.fetchall() cursor.close() return database
def crearDatabase(serlf, prueba): cursor = mysql.get_db().cursor() cursor.execute('CREATE DATABASE' + prueba) mysql.get_db().commit() cursor.close()
def delete(self,id): cursor = mysql.get_db().cursor() cursor.execute('delete from persona where idpersona = %s', (id,)) mysql.get_db().commit() cursor.close()
def listarDatabase(self): cursor = mysql.get_db().cursor() cursor.execute('show databases') schemas = cursor.fetchall() cursor.close() return schemas
def eliminarSesion(self, id): cursor = mysql.get_db().cursor() cursor.execute("DELETE FROM calendario.sesiones WHERE idsesiones = %s", (id)) mysql.get_db().commit() cursor.close()