1 # vim: set et sw=4 sts=4 encoding=utf-8 foldmethod=marker :
5 from turbogears import controllers, expose, redirect
6 from turbogears import validate, flash, error_handler
7 from turbogears import validators as V
8 from turbogears import widgets as W
9 from turbogears import identity
10 from turbogears import paginate
11 from docutils.core import publish_parts
12 from sercom.subcontrollers import validate as val
13 from sercom.model import Entrega, Correccion, Grupo, AlumnoInscripto
14 from sqlobject import *
15 from zipfile import ZipFile, BadZipfile
16 from cStringIO import StringIO
27 class MisCorreccionesController(controllers.Controller, identity.SecureResource):
28 """Basic model admin interface"""
29 require = identity.has_permission('entregar')
32 def default(self, tg_errors=None):
33 """handle non exist urls"""
34 raise redirect('list')
38 raise redirect('list')
40 @expose(template='kid:%s.templates.list' % __name__)
43 """List records in model"""
44 # Grupos en los que el usuario formo parte
45 m = [i.grupo.id for i in Grupo.selectByAlumno(identity.current.user)]
46 entregador = AlumnoInscripto.selectByAlumno(identity.current.user)
47 m.append(entregador.id)
48 r = cls.select(IN(cls.q.entregadorID, m))
49 return dict(records=r, name=name, namepl=namepl)