|
|
|
@ -25,7 +25,6 @@ class TransactionForm(forms.ModelForm):
|
|
|
|
|
class VirtualTransactionForm(forms.ModelForm):
|
|
|
|
|
""" ModelForm for :class:`Virtual Transactions <VirtualTransaction>` with a
|
|
|
|
|
currency field. """
|
|
|
|
|
|
|
|
|
|
recipient = forms.CharField(max_length=100)
|
|
|
|
|
amount = CurrencyField(label='Betrag')
|
|
|
|
|
class Meta:
|
|
|
|
@ -37,4 +36,6 @@ class VirtualTransactionForm(forms.ModelForm):
|
|
|
|
|
user = User.objects.get(username=self.cleaned_data['recipient'])
|
|
|
|
|
except User.DoesNotExist:
|
|
|
|
|
raise ValidationError(u"Emfpänger '%s' konnte nicht gefunden werden" % self.cleaned_data['recipient'])
|
|
|
|
|
if user == self.instance.user:
|
|
|
|
|
raise ValidationError(u"Emfpänger '%s' bist du selbst" % self.cleaned_data['recipient'])
|
|
|
|
|
return user
|
|
|
|
|