X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/bb3a3d03bf92ef52736ad9c4c697796cc5cbd25d..c505a0a6a9fed168f9550405018372473912ea9e:/sercom/subcontrollers/curso/__init__.py diff --git a/sercom/subcontrollers/curso/__init__.py b/sercom/subcontrollers/curso/__init__.py index c17b3cf..9d1c1f3 100644 --- a/sercom/subcontrollers/curso/__init__.py +++ b/sercom/subcontrollers/curso/__init__.py @@ -97,6 +97,9 @@ def validate_set(id, data): def validate_new(data): return val.validate_new(cls, name, data) + +def validate_del(id): + return val.validate_del(cls, name, id) #}}} def get_ejercicios(): @@ -111,6 +114,7 @@ def get_alumnos(): def get_grupos(): return [(fk1.id, fk1.shortrepr()) for fk1 in Grupo.select()] + #{{{ Formulario class CursoForm(W.TableForm): class Fields(W.WidgetsList): @@ -284,12 +288,7 @@ class CursoController(controllers.Controller, identity.SecureResource): @expose() def delete(self, id): """Destroy record in model""" - try: - r = validate_get(id) - r.destroySelf() - except Exception, e: - flash(_(u'No se pudo eliminar el curso: %s' % e)) - raise redirect('../list') + validate_del(id) flash(_(u'El %s fue eliminado permanentemente.') % name) raise redirect('../list')