fix bug: variable would be unknown

This commit is contained in:
MasterofJOKers 2012-03-11 02:09:35 +01:00
parent 4b0d637a79
commit a7ec8bc5fa
2 changed files with 3 additions and 1 deletions

View File

@ -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:

View File

@ -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)