From 2b48a56672d7f8ea8eb4ba49a4abe926ae11ddf0 Mon Sep 17 00:00:00 2001 From: Ricardo Markiewicz Date: Tue, 13 Mar 2007 11:41:48 +0000 Subject: [PATCH] Muevo alumno_inscripto dentro de curso --- sercom/controllers.py | 2 -- sercom/subcontrollers/__init__.py | 1 - sercom/subcontrollers/curso/__init__.py | 2 ++ .../alumno}/__init__.py | 29 +++++++++---------- .../alumno}/templates/__init__.py | 0 .../alumno}/templates/list.kid | 11 +++---- .../alumno}/templates/show.kid | 5 ++-- .../subcontrollers/curso/templates/list.kid | 2 +- .../subcontrollers/grupo/templates/show.kid | 2 +- 9 files changed, 23 insertions(+), 31 deletions(-) rename sercom/subcontrollers/{alumno_inscripto => curso/alumno}/__init__.py (80%) rename sercom/subcontrollers/{alumno_inscripto => curso/alumno}/templates/__init__.py (100%) rename sercom/subcontrollers/{alumno_inscripto => curso/alumno}/templates/list.kid (70%) rename sercom/subcontrollers/{alumno_inscripto => curso/alumno}/templates/show.kid (91%) diff --git a/sercom/controllers.py b/sercom/controllers.py index 9f82838..732755b 100644 --- a/sercom/controllers.py +++ b/sercom/controllers.py @@ -125,8 +125,6 @@ class Root(controllers.RootController): docente_inscripto = DocenteInscriptoController() - alumno_inscripto = AlumnoInscriptoController() - correccion = CorreccionController() admin = identity.SecureObject(CatWalk(model), identity.has_permission('admin')) diff --git a/sercom/subcontrollers/__init__.py b/sercom/subcontrollers/__init__.py index 6ca2f59..906540c 100644 --- a/sercom/subcontrollers/__init__.py +++ b/sercom/subcontrollers/__init__.py @@ -7,7 +7,6 @@ from ejercicio import EjercicioController from docente_inscripto import DocenteInscriptoController from grupo import GrupoController from correccion import CorreccionController -from alumno_inscripto import AlumnoInscriptoController from misentregas import MisEntregasController from grupo_admin import GrupoAdminController from miscorrecciones import MisCorreccionesController diff --git a/sercom/subcontrollers/curso/__init__.py b/sercom/subcontrollers/curso/__init__.py index 34e93e5..b40fdb0 100644 --- a/sercom/subcontrollers/curso/__init__.py +++ b/sercom/subcontrollers/curso/__init__.py @@ -15,6 +15,7 @@ from curso_alumno import * from sqlobject import * from sqlobject.dberrors import * from sercom.widgets import * +from alumno import AlumnoInscriptoController #}}} #{{{ Configuración @@ -168,6 +169,7 @@ class CursoController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('admin') curso_alumno = CursoAlumnoController() + alumno = AlumnoInscriptoController() @expose() def default(self, tg_errors=None): diff --git a/sercom/subcontrollers/alumno_inscripto/__init__.py b/sercom/subcontrollers/curso/alumno/__init__.py similarity index 80% rename from sercom/subcontrollers/alumno_inscripto/__init__.py rename to sercom/subcontrollers/curso/alumno/__init__.py index 80f892c..763bc06 100644 --- a/sercom/subcontrollers/alumno_inscripto/__init__.py +++ b/sercom/subcontrollers/curso/alumno/__init__.py @@ -44,12 +44,6 @@ class AlumnoInscriptoForm(W.TableForm): def get_cursos(): return [(0, u'---')] + [(fk1.id, fk1.shortrepr()) for fk1 in Curso.select()] -class AlumnoInscriptoFiltros(W.TableForm): - class Fields(W.WidgetsList): - cursoID = W.SingleSelectField(label=_(u'Curso'), options = get_cursos, validator = V.Int(not_empty=True)) - fields = Fields() - -filtro = AlumnoInscriptoFiltros() form = AlumnoInscriptoForm() #}}} @@ -71,33 +65,36 @@ class AlumnoInscriptoController(controllers.Controller, identity.SecureResource) @paginate('records') def list(self, cursoID = 0): """List records in model""" - vfilter = dict(cursoID = cursoID) - if int(cursoID) == 0: - r = cls.select() + cursoID = int(cursoID) + if cursoID == 0: + raise redirect('..') else: r = cls.select(cls.q.cursoID == cursoID) - return dict(records=r, name=name, namepl=namepl, form=filtro, vfilter=vfilter) + return dict(records=r, name=name, namepl=namepl, cursoid=cursoID) @expose(template='kid:%s.templates.notas' % __name__) - def notas(self, id, **kw): + def notas(self, id, cursoID, **kw): """Edit record in model""" + cursoID = int(cursoID) r = validate_get(id) - return dict(name=name, namepl=namepl, record=r, form=form) + return dict(name=name, namepl=namepl, record=r, form=form, cursoid=cursoID) @validate(form=form) @error_handler(notas) @expose() - def update(self, id, **kw): + def update(self, id, cursoID, **kw): """Save or create record to model""" + cursoID = int(cursoID) r = validate_set(id, kw) flash(_(u'El %s fue actualizado.') % name) - raise redirect('../list') + raise redirect('../list/%d' % cursoID) @expose(template='kid:%s.templates.show' % __name__) - def show(self,id, **kw): + def show(self,id,cursoID, **kw): """Show record in model""" + cursoID = int(cursoID) r = validate_get(id) - return dict(name=name, namepl=namepl, record=r) + return dict(name=name, namepl=namepl, record=r, cursoid=cursoID) #}}} diff --git a/sercom/subcontrollers/alumno_inscripto/templates/__init__.py b/sercom/subcontrollers/curso/alumno/templates/__init__.py similarity index 100% rename from sercom/subcontrollers/alumno_inscripto/templates/__init__.py rename to sercom/subcontrollers/curso/alumno/templates/__init__.py diff --git a/sercom/subcontrollers/alumno_inscripto/templates/list.kid b/sercom/subcontrollers/curso/alumno/templates/list.kid similarity index 70% rename from sercom/subcontrollers/alumno_inscripto/templates/list.kid rename to sercom/subcontrollers/curso/alumno/templates/list.kid index fb2fd7c..73f1f99 100644 --- a/sercom/subcontrollers/alumno_inscripto/templates/list.kid +++ b/sercom/subcontrollers/curso/alumno/templates/list.kid @@ -1,16 +1,14 @@ + py:extends="'../../../../templates/master.kid'"> list -

Administración de Objetos

- -
Filtros
+

Alumnos

@@ -22,12 +20,11 @@ - +
cursoalumnoalumno fecha corregido Tutor - Ver - Notas + Notas
diff --git a/sercom/subcontrollers/alumno_inscripto/templates/show.kid b/sercom/subcontrollers/curso/alumno/templates/show.kid similarity index 91% rename from sercom/subcontrollers/alumno_inscripto/templates/show.kid rename to sercom/subcontrollers/curso/alumno/templates/show.kid index b3b9bdb..9556a59 100644 --- a/sercom/subcontrollers/alumno_inscripto/templates/show.kid +++ b/sercom/subcontrollers/curso/alumno/templates/show.kid @@ -1,6 +1,6 @@ + py:extends="'../../../../templates/master.kid'"> show @@ -67,8 +67,7 @@
-Editar | -Volver +Volver diff --git a/sercom/subcontrollers/curso/templates/list.kid b/sercom/subcontrollers/curso/templates/list.kid index 059c7d3..005d41d 100644 --- a/sercom/subcontrollers/curso/templates/list.kid +++ b/sercom/subcontrollers/curso/templates/list.kid @@ -32,7 +32,7 @@ anio descripcion Docentes - Alumnos + Alumnos Grupos Ejercicio Ver diff --git a/sercom/subcontrollers/grupo/templates/show.kid b/sercom/subcontrollers/grupo/templates/show.kid index 6bacb0a..3d593d1 100644 --- a/sercom/subcontrollers/grupo/templates/show.kid +++ b/sercom/subcontrollers/grupo/templates/show.kid @@ -33,7 +33,7 @@ Integrantes: - +
-- 2.43.0