diff options
| author | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:41:28 +0200 |
|---|---|---|
| committer | Alexis Metaireau <alexis@notmyidea.org> | 2011-07-31 00:41:28 +0200 |
| commit | 2df6e11f05eff9bd855079097aa865f52689d7ca (patch) | |
| tree | 6de593b6d68b2ee91c211af71a3168ba261293cf /budget/forms.py | |
| parent | 3bbc3343a2409de3cccdd7f50360e631224bf066 (diff) | |
| download | ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.zip ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.tar.gz ihatemoney-mirror-2df6e11f05eff9bd855079097aa865f52689d7ca.tar.bz2 | |
Adding a bill is now working properly
Diffstat (limited to 'budget/forms.py')
| -rw-r--r-- | budget/forms.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/budget/forms.py b/budget/forms.py index 0d9dae5..9abbb16 100644 --- a/budget/forms.py +++ b/budget/forms.py @@ -1,7 +1,6 @@ from flaskext.wtf import * -from models import Project, Person +from models import Project, Person, Bill -# define forms class ProjectForm(Form): name = TextField("Project name", validators=[Required()]) id = TextField("Project identifier", validators=[Required()]) @@ -34,6 +33,15 @@ class BillForm(Form): validators=[Required()]) submit = SubmitField("Add the bill") + def save(self): + bill = Bill(payer_id=self.payer.data, amount=self.amount.data, + what=self.what.data) + # set the owers + for ower in self.payed_for.data: + bill.owers.append(Person.query.get(ower)) + + return bill + class MemberForm(Form): def __init__(self, project, *args, **kwargs): @@ -48,6 +56,7 @@ class MemberForm(Form): .filter(Person.project == form.project).all(): raise ValidationError("This project already have this member") + class InviteForm(Form): emails = TextAreaField("People to notify") submit = SubmitField("Send invites") |
