X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/959e53d319ef119367ffe4a724da938151276657..b784363dcb9c7bf8e242c68950c77fb11ee5356a:/sercom/subcontrollers/docente/__init__.py?ds=sidebyside diff --git a/sercom/subcontrollers/docente/__init__.py b/sercom/subcontrollers/docente/__init__.py index b8805b9..12fd147 100644 --- a/sercom/subcontrollers/docente/__init__.py +++ b/sercom/subcontrollers/docente/__init__.py @@ -1,5 +1,6 @@ -# vim: set et sw=4 sts=4 encoding=utf-8 : +# vim: set et sw=4 sts=4 encoding=utf-8 foldmethod=marker : +#{{{ Imports import cherrypy from turbogears import controllers, expose, redirect from turbogears import validate, validators, flash, error_handler @@ -9,15 +10,26 @@ from turbogears import paginate from docutils.core import publish_parts from sercom.subcontrollers import validate as val from sercom.model import Docente +#}}} +#{{{ Configuración cls = Docente name = 'docente' namepl = name + 's' +#}}} -def validate_get(id): return val.validate_get(cls, name, id) -def validate_set(id, data): return val.validate_set(cls, name, id, data) -def validate_new(data): return val.validate_new(cls, name, data) +#{{{ Validación +def validate_get(id): + return val.validate_get(cls, name, id) +def validate_set(id, data): + return val.validate_set(cls, name, id, data) + +def validate_new(data): + return val.validate_new(cls, name, data) +#}}} + +#{{{ Formulario form = TableForm(fields=[ TextField(name='usuario', label=_(u'Usuario'), help_text=_(u'Requerido y único.'), @@ -43,7 +55,10 @@ form = TableForm(fields=[ #help_text=_(u'Si no está activo no puede ingresar al sistema.'), validator=validators.Bool(if_empty=1)), ]) +form.javascript.append(JSSource("MochiKit.DOM.focusOnLoad('form_usuario');")) +#}}} +#{{{ Controlador class DocenteController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" require = identity.has_permission('admin') @@ -120,4 +135,5 @@ class DocenteController(controllers.Controller, identity.SecureResource): r.destroySelf() flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list') +#}}}