Beispiel #1
0
    def edit(self, id, tg_errors=None, **kw):
        """Edit record in model"""
        record = Docente.get(int(id))

        if (identity.current.user_id == int(id) \
            or "admin" in identity.current.groups \
            or "JTP" in identity.current.groups):
            self.checkRoles(record)

            if tg_errors:
                msg = 'Hay uno o más errores:\n'
                for field, error in tg_errors.items():
                    msg += '%s: %s\n' % (field, error)
                flash(msg)

            return dict(name=name, namepl=namepl, record=record, form=form, values=kw)
        else:
            flash(_(u'Solo podes editar tus propios datos.'))
            raise redirect('../list')
Beispiel #2
0
def get_docentes():
    return [(d.id, d) for d in Docente.select()]
Beispiel #3
0
def get_docentes():
    return [(d.id, d) for d in Docente.selectBy(activo=True)]