aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
authorFrédéric Sureau <fred@milka.(none)>2011-08-09 18:28:48 +0200
committerFrédéric Sureau <fred@milka.(none)>2011-08-09 18:28:48 +0200
commitcb05727ec3d10de25d23a7bcf8c108bb6640327a (patch)
tree06f0aa5ba1976765394a506e2249c360b7eff0a8 /budget/forms.py
parent3c5ac5b78286a1670043aba06f2b7164f44d36c2 (diff)
downloadihatemoney-mirror-cb05727ec3d10de25d23a7bcf8c108bb6640327a.zip
ihatemoney-mirror-cb05727ec3d10de25d23a7bcf8c108bb6640327a.tar.gz
ihatemoney-mirror-cb05727ec3d10de25d23a7bcf8c108bb6640327a.tar.bz2
We now are able to set the date when adding a bill.
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 3327f21..afa86cc 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -1,5 +1,6 @@
from flaskext.wtf import *
from models import Project, Person, Bill
+from datetime import datetime
class ProjectForm(Form):
name = TextField("Project name", validators=[Required()])
@@ -26,6 +27,7 @@ class AuthenticationForm(Form):
class BillForm(Form):
+ date = DateField("Date", validators=[Required()], default=datetime.now)
what = TextField("What?", validators=[Required()])
payer = SelectField("Payer", validators=[Required()])
amount = DecimalField("Amount payed", validators=[Required()])
@@ -35,7 +37,7 @@ class BillForm(Form):
def save(self):
bill = Bill(payer_id=self.payer.data, amount=self.amount.data,
- what=self.what.data)
+ what=self.what.data, date=self.date.data)
# set the owers
for ower in self.payed_for.data:
bill.owers.append(Person.query.get(ower))