Fixed Transaction ,-usage and error for transactiontype

This commit is contained in:
Sebastian Lohff 2011-11-10 17:06:39 +01:00
parent b71b95436f
commit 9bad46cf2d
2 changed files with 3 additions and 2 deletions

View File

@ -23,7 +23,7 @@ class CurrencyField (forms.RegexField):
self.currencyRe, None, None, *args, **kwargs) self.currencyRe, None, None, *args, **kwargs)
def to_python(self, value): def to_python(self, value):
try: try:
value = Decimal(value) value = Decimal(value.replace(",", "."))
except (ValueError, TypeError, InvalidOperation): except (ValueError, TypeError, InvalidOperation):
raise ValidationError("Bitte gib eine Zahl ein") raise ValidationError("Bitte gib eine Zahl ein")
return value return value

View File

@ -18,7 +18,8 @@ class TransactionForm(forms.ModelForm):
def clean(self): def clean(self):
# needed to enforce TransactionTypes needsCheck "default value" # needed to enforce TransactionTypes needsCheck "default value"
cleaned_data = super(TransactionForm, self).clean() cleaned_data = super(TransactionForm, self).clean()
self.instance.checked = not cleaned_data['transactionType'].needsCheck if cleaned_data.has_key("transactionType"):
self.instance.checked = not cleaned_data['transactionType'].needsCheck
return cleaned_data return cleaned_data
class VirtualTransactionForm(forms.ModelForm): class VirtualTransactionForm(forms.ModelForm):