Exemple #1
0
def add():
    form = CaseForm()
    if form.validate_on_submit():

        case = Case(name=form.name)
        form.populate_obj(case)
        case.author = current_user
        case.save()
        flash("Add Test Case successfully")
        return redirect(url_for("case.view", case_id=case.id))
Exemple #2
0
def edit(case_id):
    case = Case.query.get_or_404(case_id)
    # case.permissions.edit.test(403)
    form = CaseForm(obj=case)
    if form.validate_on_submit():
        form.populate_obj(case)
        case.save()
        flash(u"你的条目已更新", "successfully")
        return redirect(url_for("case.view", case_id=case_id))
    return render_template("case/edit_case.html", case=case, form=form)
Exemple #3
0
def add():
    form = CaseForm()
    if form.validate_on_submit():

        case = Case(name=form.name)
        form.populate_obj(case)
        case.author = current_user
        case.save()
        flash("Add Test Case successfully")
        return redirect(url_for("case.view", case_id=case.id))
    return render_template("case/add.html", form=form)
Exemple #4
0
    def edit_comment_form(comment):
        return CommentForm(obj=comment)

    return render_template(
        "case/case.html",
        #comment_form=CommentForm(),
        #edit_comment_form=edit_comment_form,
        case=case)


@mod.route("/<int:case_id>/edit/", methods=['GET', 'POST'])
#@auth.require(401)
def edit(case_id):
    case = Case.query.get_or_404(case_id)
    #case.permissions.edit.test(403)
    form = CaseForm(obj=case)
    if form.validate_on_submit():
        form.populate_obj(case)
        case.save()
        flash(u"你的条目已更新", "successfully")
        return redirect(url_for("case.view", case_id=case_id))
    return render_template("case/edit_case.html", case=case, form=form)


@mod.route("/<int:case_id>/delete/", methods=("POST", ))
#@auth.require(401)
def delete(case_id):
    case = Case.query.get_or_404(case_id)
    #case.permissions.delete.test(403)
    case.delete()
    #if current_user.id != case.author_id: