def edit(user_id):
    roles = Role.query.all()
    user = User.query.get(user_id)

    if request.method == 'POST':
        return update(form=request.form, user=user, roles=roles)
    else:
        return render_template('user/edit.html',
                               roles=roles,
                               user=user,
                               user_id=user_id,
                               config=get_web_config())
def update(form, user, roles):
    form = UserEditForm(form, user)

    if form.is_valid():
        user.update(form.values)
        flash(form.success_message(), 'success')
        return redirect(url_for('user_edit', user_id=user.id))
    else:
        for error in form.error_messages():
            flash(error, 'danger')
        return render_template('user/edit.html',
                               roles=roles,
                               user=form.values,
                               user_id=user.id,
                               config=get_web_config())
Esempio n. 3
0
def edit(teacher_id):
    teacher = Teacher.query.get(teacher_id)

    if request.method == 'POST':
        return update(
            form=request.form,
            teacher=teacher,
        )
    else:
        generos = Gender.query.all()
        return render_template('teacher/edit.html',
                               academic=teacher,
                               genders=generos,
                               academic_id=teacher_id,
                               config=get_web_config())
Esempio n. 4
0
def update(form, teacher):
    form = TeacherEditForm(form, teacher)

    if form.is_valid():
        teacher.update(form.values)
        flash(form.success_message(), 'success')
        return redirect(url_for('teacher_edit', teacher_id=teacher.id))
    else:
        for error in form.error_messages():
            flash(error, 'danger')
        generos = Gender.query.all()
        return render_template('teacher/edit.html',
                               academic=form.values,
                               genders=generos,
                               academic_id=teacher.id,
                               config=get_web_config())
def index():
    users = User.query.all()
    return render_template('user/index.html',
                           users=users,
                           config=get_web_config(),
                           current_user=current_user)
def profile(student_id):
    estudiante = Student.query.get(student_id)
    return render_template('student/profile.html',
                           user=estudiante,
                           config=get_web_config())
def workshops(student_id):
    student = Student.query.get(student_id)
    return render_template('student/workshops.html',
                           academic=student,
                           config=get_web_config())
Esempio n. 8
0
def index():
    if current_user.is_authenticated:
        return redirect(url_for('secciones'))
    return render_template('home/home.html', config=get_web_config())
Esempio n. 9
0
def sections():
    return render_template('home/secciones.html',
                           config=get_web_config(),
                           current_user=current_user)
Esempio n. 10
0
def index():
    return render_template('webconfig/webconfig.html', config=get_web_config())
Esempio n. 11
0
def profile(user_id):
    user = User.query.get(user_id)
    return render_template('user/profile.html',
                           user=user,
                           config=get_web_config(),
                           current_user=current_user)
Esempio n. 12
0
def index():
    teachers = Teacher.query.all()
    return render_template('teacher/index.html',
                           teachers=teachers,
                           config=get_web_config(),
                           current_user=current_user)
Esempio n. 13
0
def profile(teacher_id):
    docente = Teacher.query.get(teacher_id)
    return render_template('teacher/profile.html',
                           user=docente,
                           config=get_web_config())
Esempio n. 14
0
def workshops(teacher_id):
    teacher = Teacher.query.get(teacher_id)
    return render_template('teacher/workshops.html',
                           academic=teacher,
                           config=get_web_config())