aboutsummaryrefslogtreecommitdiff
path: root/budget/forms.py
diff options
context:
space:
mode:
authorAlexis Metaireau <alexis@notmyidea.org>2011-10-18 18:13:54 +0200
committerAlexis Metaireau <alexis@notmyidea.org>2011-10-18 18:13:54 +0200
commitb88b317faa8b462c3c932ed59903122a580ae825 (patch)
treeb6654438806a258ed642a3c30feefb8ef7962108 /budget/forms.py
parent6e3834048b2b23a07afd5d2354b92131c2c175f9 (diff)
downloadihatemoney-mirror-b88b317faa8b462c3c932ed59903122a580ae825.zip
ihatemoney-mirror-b88b317faa8b462c3c932ed59903122a580ae825.tar.gz
ihatemoney-mirror-b88b317faa8b462c3c932ed59903122a580ae825.tar.bz2
Bills can't be negative. Fix #45
Diffstat (limited to 'budget/forms.py')
-rw-r--r--budget/forms.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/budget/forms.py b/budget/forms.py
index 5abbd84..d0a60ca 100644
--- a/budget/forms.py
+++ b/budget/forms.py
@@ -120,6 +120,10 @@ class BillForm(Form):
def set_default(self):
self.payed_for.data = self.payed_for.default
+ def validate_amount(self, field):
+ if field.data < 0:
+ raise ValidationError(_("Bills can't be negative"))
+
class MemberForm(Form):