Beispiel #1
0
 def update(self, project):
     form = EditProjectForm(csrf_enabled=False)
     if form.validate():
         form.update(project)
         db.session.commit()
         return 200, "UPDATED"
     return 400, form.errors
Beispiel #2
0
 def update(self, project):
     form = EditProjectForm(csrf_enabled=False)
     if form.validate():
         form.update(project)
         db.session.commit()
         return 200, "UPDATED"
     return 400, form.errors
Beispiel #3
0
def edit_project():
    form = EditProjectForm()
    if request.method == "POST":
        if form.validate():
            project = form.update(g.project)
            db.session.commit()
            session[project.id] = project.password

            return redirect(url_for(".list_bills"))
    else:
        form.name.data = g.project.name
        form.password.data = g.project.password
        form.contact_email.data = g.project.contact_email

    return render_template("edit_project.html", form=form)
Beispiel #4
0
def edit_project():
    form = EditProjectForm()
    if request.method == "POST":
        if form.validate():
            project = form.update(g.project)
            db.session.commit()
            session[project.id] = project.password

            return redirect(url_for(".list_bills"))
    else:
        form.name.data = g.project.name
        form.password.data = g.project.password
        form.contact_email.data = g.project.contact_email

    return render_template("edit_project.html", form=form)