From: Leandro Lucarella Date: Thu, 15 Mar 2007 20:11:49 +0000 (+0000) Subject: Agregar rol a Alumno cuando se crea. X-Git-Tag: 0_9_0~90 X-Git-Url: https://git.llucax.com/software/sercom.git/commitdiff_plain/f8e0f8df0b9169f34109c752c63d67851c319ff7?ds=sidebyside;hp=33ac7d6d267d9f25c76c2488b79ebd1794de996e Agregar rol a Alumno cuando se crea. --- diff --git a/sercom/subcontrollers/alumno/__init__.py b/sercom/subcontrollers/alumno/__init__.py index 2eb418f..7dd7f01 100644 --- a/sercom/subcontrollers/alumno/__init__.py +++ b/sercom/subcontrollers/alumno/__init__.py @@ -107,6 +107,7 @@ class AlumnoController(controllers.Controller, identity.SecureResource): @expose() def create(self, **kw): """Save or create record to model""" + kw['roles'] = [Rol.by_nombre('alumno')] validate_new(kw) flash(_(u'Se creó un nuevo %s.') % name) raise redirect('list') @@ -163,7 +164,7 @@ class AlumnoController(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')]) u.email = row[2] u.telefono = row[3] u.password = row[0] diff --git a/sercom/subcontrollers/curso/__init__.py b/sercom/subcontrollers/curso/__init__.py index d73b01b..fe63512 100644 --- a/sercom/subcontrollers/curso/__init__.py +++ b/sercom/subcontrollers/curso/__init__.py @@ -10,7 +10,7 @@ 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 * @@ -298,7 +298,7 @@ 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: