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)
def to_python(self, value):
try:
value = Decimal(value)
value = Decimal(value.replace(",", "."))
except (ValueError, TypeError, InvalidOperation):
raise ValidationError("Bitte gib eine Zahl ein")
return value

View File

@ -18,7 +18,8 @@ class TransactionForm(forms.ModelForm):
def clean(self):
# needed to enforce TransactionTypes needsCheck "default value"
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
class VirtualTransactionForm(forms.ModelForm):