diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2011-09-14 22:03:18 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2011-09-14 22:03:18 +0200 |
| commit | 20ab40690d74befcd8fc75f24f301759840bf43a (patch) | |
| tree | d92319ad0f5cc6b6b506f8c918fd30549eb81b69 /budget/web.py | |
| parent | 5721be1d15ba02e47f98fb9a487248adb297a082 (diff) | |
| download | ihatemoney-mirror-20ab40690d74befcd8fc75f24f301759840bf43a.zip ihatemoney-mirror-20ab40690d74befcd8fc75f24f301759840bf43a.tar.gz ihatemoney-mirror-20ab40690d74befcd8fc75f24f301759840bf43a.tar.bz2 | |
Provide a way to edit a project. Fix #17
Diffstat (limited to 'budget/web.py')
| -rw-r--r-- | budget/web.py | 20 |
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 |
