X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/a6c473f24950a49e8af6caf1cd19759d7e0dc2ad..5abdab4db1be106faafe469314fa939d1948399b:/sercom/subcontrollers/curso/__init__.py diff --git a/sercom/subcontrollers/curso/__init__.py b/sercom/subcontrollers/curso/__init__.py index 3ad2133..699bc79 100644 --- a/sercom/subcontrollers/curso/__init__.py +++ b/sercom/subcontrollers/curso/__init__.py @@ -10,13 +10,14 @@ from turbogears import identity from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val -from sercom.model import Curso, Correccion, Ejercicio, Alumno, Docente, Grupo, DocenteInscripto +from sercom.model import Curso, Correccion, Ejercicio, Alumno, Docente, Grupo, DocenteInscripto, Rol from curso_alumno import * from sqlobject import * from sqlobject.dberrors import * from sercom.widgets import * from alumno import AlumnoInscriptoController from grupo import GrupoController +from ejercicio import EjercicioController #}}} #{{{ Configuración @@ -163,6 +164,7 @@ class CursoController(controllers.Controller, identity.SecureResource): curso_alumno = CursoAlumnoController() alumno = AlumnoInscriptoController() grupo = GrupoController() + ejercicio = EjercicioController() @expose() def default(self, tg_errors=None): @@ -177,7 +179,7 @@ class CursoController(controllers.Controller, identity.SecureResource): @paginate('records') def list(self): """List records in model""" - r = cls.select() + r = cls.select().orderBy((-cls.q.anio, -cls.q.cuatrimestre, cls.q.numero)) return dict(records=r, name=name, namepl=namepl) @expose() @@ -298,13 +300,13 @@ class CursoController(controllers.Controller, identity.SecureResource): if row == []: continue try: - u = Alumno(row[0], nombre=row[1]) + u = Alumno(row[0], nombre=row[1], roles=[Rol.by_nombre('alumno')]) except: u = Alumno.byPadron(row[0]) try: u.email = row[2] u.telefono = row[3] - u.contrasenia = row[0] + u.password = row[0] u.activo = True curso.add_alumno(u) ok.append(row)