From b88b317faa8b462c3c932ed59903122a580ae825 Mon Sep 17 00:00:00 2001 From: Alexis Metaireau Date: Tue, 18 Oct 2011 18:13:54 +0200 Subject: Bills can't be negative. Fix #45 --- budget/forms.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'budget/forms.py') 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): -- cgit v1.1