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')
34 def default(self, tg_errors=None):
35 """handle non exist urls"""
36 raise redirect('list')
40 raise redirect('list')
42 @expose(template='kid:%s.templates.list' % __name__)
45 """List records in model"""
46 # Grupos en los que el usuario formo parte
47 m = [i.grupo.id for i in Grupo.selectByAlumno(identity.current.user)]
49 entregador = AlumnoInscripto.selectByAlumno(identity.current.user)
50 m.append(entregador.id)
53 r = cls.select(IN(cls.q.entregadorID, m))
54 return dict(records=r, name=name, namepl=namepl)