From a6c473f24950a49e8af6caf1cd19759d7e0dc2ad Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Thu, 15 Mar 2007 16:46:49 +0000 Subject: [PATCH 1/1] =?utf8?q?Limpiar=20y=20simplificar=20GrupoController.?= =?utf8?q?=20Ahora=20tambi=C3=A9n=20s=C3=B3lo=20se=20da=20para=20elegir=20?= =?utf8?q?docentes=20*activos*.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- sercom/subcontrollers/curso/__init__.py | 30 +++++-------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/sercom/subcontrollers/curso/__init__.py b/sercom/subcontrollers/curso/__init__.py index 0528def..3ad2133 100644 --- a/sercom/subcontrollers/curso/__init__.py +++ b/sercom/subcontrollers/curso/__init__.py @@ -104,17 +104,8 @@ def validate_del(id): return val.validate_del(cls, name, id) #}}} -def get_ejercicios(): - return [(fk1.id, fk1.shortrepr()) for fk1 in Ejercicio.select()] - def get_docentes(): - return [(fk1.id, fk1.shortrepr()) for fk1 in Docente.select()] - -def get_alumnos(): - return [(fk1.id, fk1.shortrepr()) for fk1 in Alumno.select()] - -def get_grupos(): - return [(fk1.id, fk1.shortrepr()) for fk1 in Grupo.select()] + return [(fk1.id, fk1.shortrepr()) for fk1 in Docente.selectBy(activo=True)] #{{{ Formulario @@ -229,20 +220,10 @@ class CursoController(controllers.Controller, identity.SecureResource): def edit(self, id, **kw): """Edit record in model""" r = validate_get(id) - class EmptyClass: - pass - values = EmptyClass() - values.id = r.id - values.anio = r.anio - values.numero = r.numero - values.cuatrimestre = r.cuatrimestre - values.cursoID = r.id - values.descripcion = r.descripcion # cargo la lista con los docentes asignados al curso - values.docentes_to = [{"id":d.docente.id, "label":d.docente.shortrepr()} for d in DocenteInscripto.selectBy(curso=r.id)] - values.alumnos_inscriptos = [{"id":a.alumno.id, "label":a.alumno.shortrepr()} for a in AlumnoInscripto.selectBy(curso=r.id)] - - return dict(name=name, namepl=namepl, record=values, form=form) + r.docentes_to = [{"id":d.docente.id, "label":d.docente.shortrepr()} for d in r.docentes] + r.alumnos_inscriptos = [{"id":a.alumno.id, "label":a.alumno.shortrepr()} for a in r.alumnos] + return dict(name=name, namepl=namepl, record=r, form=form) @validate(form=form) @error_handler(edit) @@ -372,7 +353,7 @@ class CursoController(controllers.Controller, identity.SecureResource): if c[0].nota > 7: correctas += 1 else: - col["E"+str(ej.numero)+str(ins.numero)] = "" + col["E"+str(ej.numero)+str(ins.numero)] = "" col["EA"] = correctas col["NP"] = i.nota_practica col["NF"] = i.nota_final @@ -427,7 +408,6 @@ class CursoController(controllers.Controller, identity.SecureResource): s = ",".join(cols) + "\n" for i in rows: s = s + ",".join(i) + "\n" - return s #}}} -- 2.43.0