Fixed transaction checking.

Now the default value for the form is set to the value
given in TransactionType.needsCheck
This commit is contained in:
Sebastian Lohff 2011-10-21 18:41:27 +02:00
parent eaf1551fa1
commit fd46332e65
1 changed files with 4 additions and 0 deletions

View File

@ -11,3 +11,7 @@ class TransactionForm(forms.ModelForm):
def clean_amount(self): def clean_amount(self):
data = self.cleaned_data['amount'] data = self.cleaned_data['amount']
return data return data
def clean(self):
cleaned_data = super(TransactionForm, self).clean()
self.instance.checked = not cleaned_data['transactionType'].needsCheck
return cleaned_data