X-Git-Url: https://git.llucax.com/z.facultad/75.52/sercom.git/blobdiff_plain/50ac259f4dbe8e25e0a790a9ae2528dffa970195..3ae577cc9f4542b007bd9ff93457c8f01b93a68a:/sercom/subcontrollers/ejercicio/__init__.py diff --git a/sercom/subcontrollers/ejercicio/__init__.py b/sercom/subcontrollers/ejercicio/__init__.py index d04dde1..58a36b2 100644 --- a/sercom/subcontrollers/ejercicio/__init__.py +++ b/sercom/subcontrollers/ejercicio/__init__.py @@ -71,6 +71,9 @@ def validate_new(data): validate_fk(data) validate_fk1(data) return val.validate_new(cls, name, data) + +def validate_del(id): + return val.validate_del(cls, name, id) #}}} #{{{ Formulario @@ -162,7 +165,7 @@ form = EjercicioForm() #{{{ Controlador class EjercicioController(controllers.Controller, identity.SecureResource): """Basic model admin interface""" - require = identity.has_permission('admin') + require = identity.has_permission('entregar') entrega = EntregaController() @@ -184,12 +187,14 @@ class EjercicioController(controllers.Controller, identity.SecureResource): return dict(records=r, name=name, namepl=namepl, parcial=autor) @expose(template='kid:%s.templates.new' % __name__) + @identity.require(identity.has_permission('admin')) def new(self, **kw): """Create new records in model""" return dict(name=name, namepl=namepl, form=form, values=kw) @validate(form=form) @error_handler(new) + @identity.require(identity.has_permission('admin')) @expose() def create(self, **kw): """Save or create record to model""" @@ -198,6 +203,7 @@ class EjercicioController(controllers.Controller, identity.SecureResource): raise redirect('list') @expose(template='kid:%s.templates.edit' % __name__) + @identity.require(identity.has_permission('admin')) def edit(self, id, **kw): """Edit record in model""" r = validate_get(id) @@ -206,6 +212,7 @@ class EjercicioController(controllers.Controller, identity.SecureResource): @validate(form=form) @error_handler(edit) @expose() + @identity.require(identity.has_permission('admin')) def update(self, id, **kw): """Save or create record to model""" r = validate_set(id, kw) @@ -219,10 +226,10 @@ class EjercicioController(controllers.Controller, identity.SecureResource): return dict(name=name, namepl=namepl, record=r) @expose() + @identity.require(identity.has_permission('admin')) def delete(self, id): """Destroy record in model""" - r = validate_get(id) - r.destroySelf() + validate_del(id) flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list')