From a7ec8bc5faaed56f258b104fbc679d66ebf513e8 Mon Sep 17 00:00:00 2001 From: MasterofJOKers Date: Sun, 11 Mar 2012 02:09:35 +0100 Subject: [PATCH] fix bug: variable would be unknown --- k4ever/transaction/forms.py | 2 ++ k4ever/transaction/models.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/k4ever/transaction/forms.py b/k4ever/transaction/forms.py index 734b78b..087e451 100644 --- a/k4ever/transaction/forms.py +++ b/k4ever/transaction/forms.py @@ -41,6 +41,8 @@ class VirtualTransactionForm(forms.ModelForm): exclude = ('user', 'dateTime') def clean_recipient(self): + """ Checks for existance of the recipient and it is different from the + user issueing this transaction. """ try: user = User.objects.get(username=self.cleaned_data['recipient']) except User.DoesNotExist: diff --git a/k4ever/transaction/models.py b/k4ever/transaction/models.py index 2e1135b..dd72203 100644 --- a/k4ever/transaction/models.py +++ b/k4ever/transaction/models.py @@ -122,6 +122,6 @@ class VirtualTransaction(models.Model): # Only revert if both users exist. if instance.user and instance.recipient: # revert transaction - VirtualTransaction.moveMoney(instance.recipient, instance.user, amount) + VirtualTransaction.moveMoney(instance.recipient, instance.user, instance.amount) pre_delete.connect(VirtualTransaction.pre_delete_signal, sender=VirtualTransaction)