From fd46332e6560491f91f76e97c1ab48d0ab9d5cf2 Mon Sep 17 00:00:00 2001 From: Sebastian Lohff Date: Fri, 21 Oct 2011 18:41:27 +0200 Subject: [PATCH] Fixed transaction checking. Now the default value for the form is set to the value given in TransactionType.needsCheck --- k4ever/transaction/forms.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/k4ever/transaction/forms.py b/k4ever/transaction/forms.py index 90f7bda..31afec7 100644 --- a/k4ever/transaction/forms.py +++ b/k4ever/transaction/forms.py @@ -11,3 +11,7 @@ class TransactionForm(forms.ModelForm): def clean_amount(self): data = self.cleaned_data['amount'] return data + def clean(self): + cleaned_data = super(TransactionForm, self).clean() + self.instance.checked = not cleaned_data['transactionType'].needsCheck + return cleaned_data