aboutsummaryrefslogtreecommitdiff
path: root/budget/web.py
diff options
context:
space:
mode:
Diffstat (limited to 'budget/web.py')
-rw-r--r--budget/web.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/budget/web.py b/budget/web.py
index 7376135..250359d 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -7,7 +7,7 @@ import werkzeug
# local modules
from models import db, Project, Person, Bill
from forms import (ProjectForm, AuthenticationForm, BillForm, MemberForm,
- InviteForm, CreateArchiveForm)
+ InviteForm, CreateArchiveForm, EditProjectForm)
from utils import get_billform_for, Redirect303
"""
@@ -130,6 +130,24 @@ def create_project():
return render_template("create_project.html", form=form)
+@main.route("/<project_id>/edit", methods=["GET", "POST"])
+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)
+
+
@main.route("/exit")
def exit():
# delete the session