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())
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())
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())
def index(): if current_user.is_authenticated: return redirect(url_for('secciones')) return render_template('home/home.html', config=get_web_config())
def sections(): return render_template('home/secciones.html', config=get_web_config(), current_user=current_user)
def index(): return render_template('webconfig/webconfig.html', config=get_web_config())
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)
def index(): teachers = Teacher.query.all() return render_template('teacher/index.html', teachers=teachers, config=get_web_config(), current_user=current_user)
def profile(teacher_id): docente = Teacher.query.get(teacher_id) return render_template('teacher/profile.html', user=docente, config=get_web_config())
def workshops(teacher_id): teacher = Teacher.query.get(teacher_id) return render_template('teacher/workshops.html', academic=teacher, config=get_web_config())