コード例 #1
0
def view(id=None, level_id=None):
    level = None

    if level_id:
        level = get_or_404(Level, id=level_id)

    elif current_user.grade:
        level = Level.objects.get(description=current_user.grade)

    if not current_user.grade:
        form = update_details_form()

        if form.validate_on_submit():
            current_user.update(grade=form.grade.data)
            flash('Successfully updated profile')
            return redirect(url_for('.view', id=id))

    not_linked = Competency.objects.filter(
        id__nin=[c.id for c in current_user.competencies])

    return render_template(
        'competency/view.html',
        level=level,
        competency=get_or_404(Competency, id=id),
        comps_not_linked=not_linked)
コード例 #2
0
def view(id=None, level_id=None):
    level = None

    if level_id:
        level = get_or_404(Level, id=level_id)

    elif current_user.grade:
        level = Level.objects.get(description=current_user.grade)

    if not current_user.grade:
        form = update_details_form()

        if form.validate_on_submit():
            current_user.update(grade=form.grade.data)
            flash("Successfully updated profile")
            return redirect(url_for(".view", id=id))

    return render_template("competency/view.html", level=level, competency=get_or_404(Competency, id=id))
コード例 #3
0
def grade_form():
    return dict(grade_form=update_details_form())
コード例 #4
0
def grade_form():
    return dict(grade_form=update_details_form())