aboutsummaryrefslogtreecommitdiff
path: root/budget/web.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-08-22 23:19:00 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-08-22 23:19:00 +0200
commit5550e18cfd628fcb7431f560323f681d06d3edc7 (patch)
tree1cb5adc10d0e43b359279e35c7fca4c0912bd254 /budget/web.py
parent9eab5be9a33e7dab46e7de4692ca788868d816dc (diff)
downloadihatemoney-mirror-5550e18cfd628fcb7431f560323f681d06d3edc7.zip
ihatemoney-mirror-5550e18cfd628fcb7431f560323f681d06d3edc7.tar.gz
ihatemoney-mirror-5550e18cfd628fcb7431f560323f681d06d3edc7.tar.bz2
Add missing tests. Fixes #14 and #22.
Diffstat (limited to 'budget/web.py')
-rw-r--r--budget/web.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/budget/web.py b/budget/web.py
index 78886d8..c69189e 100644
--- a/budget/web.py
+++ b/budget/web.py
@@ -173,6 +173,14 @@ def add_member():
form = MemberForm(g.project)
if request.method == "POST":
if form.validate():
+ # if the user is already bound to the project, just reactivate him
+ person = Person.query.filter(Person.name == form.name.data)\
+ .filter(Project.id == g.project.id).all()
+ if person:
+ person[0].activated = True
+ db.session.commit()
+ return redirect(url_for("list_bills"))
+
db.session.add(Person(name=form.name.data, project=g.project))
db.session.commit()
return redirect(url_for("list_bills"))