Esempio n. 1
0
def edit(result_id):
    result = Result.query.get_or_404(result_id)
    #result.permissions.edit.test(403)
    form = ResultForm(obj=result)
    if form.validate_on_submit():
        form.populate_obj(result)
        result.save()
        flash(u"你的条目已更新", "successfully")
        return redirect(url_for("result.view", result_id=result_id))
    return render_template("result/edit_result.html", result=result, form=form)
Esempio n. 2
0
def edit(result_id):
    result = Result.query.get_or_404(result_id)                                                                          
    #result.permissions.edit.test(403)                                                                                
    form = ResultForm(obj=result)
    if form.validate_on_submit():                                                                                  
        form.populate_obj(result)                                                                                    
        result.save()
        flash(u"你的条目已更新", "successfully")
        return redirect(url_for("result.view", result_id=result_id))                                                     
    return render_template("result/edit_result.html",                                                                  
                           result=result,                                                                              
                           form=form)                                                                              
Esempio n. 3
0
def add():
    form = ResultForm()
    form.case.choices = [(c.id, c.name) for c in Case.query.all()]
    if form.validate_on_submit():

        result = Result()
        form.populate_obj(result)
        result.case = Case.query.filter(Case.id==form.case.data).first_or_404()
        result.author = current_user
        result.save()
        flash("Add Test Result successfully")
        return redirect(url_for("result.view", result_id=result.id))
    return render_template("result/add.html", form=form)
Esempio n. 4
0
def add():
    form = ResultForm()
    form.case.choices = [(c.id, c.name) for c in Case.query.all()]
    if form.validate_on_submit():

        result = Result()
        form.populate_obj(result)
        result.case = Case.query.filter(
            Case.id == form.case.data).first_or_404()
        result.author = current_user
        result.save()
        flash("Add Test Result successfully")
        return redirect(url_for("result.view", result_id=result.id))
    return render_template("result/add.html", form=form)