Fixed Transaction ,-usage and error for transactiontype
This commit is contained in:
parent
b71b95436f
commit
9bad46cf2d
|
@ -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
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue