示例#1
0
def index():
    form = HesoForm(request.form)
    if request.method == 'POST':
        if form.validate():
            create_heso(extract_heso(form), session.get('username'))
            return redirect(url_for('index'))
        flash(u'all fields are required.')
    hesoes = get_all_heso()
    return render_template('index.html', hesoes=hesoes, form=form,
                           for_create=True)
示例#2
0
def heso(reponame, rev):
    if request.method == 'POST':
        form = HesoForm(request.form)
        if form.validate():
            update_heso(reponame, extract_heso(form), session.get('username'))
            return redirect(url_for('heso_latest', reponame=reponame))
        flash(u'all fields are required.')
    else:
        form = HesoForm(**get_heso(reponame, rev))
    history = get_history(reponame)
    comments = get_all_comment(reponame)
    return render_template('index.html', reponame=reponame, form=form,
                           history=history, comments=comments)