fix bug: variable would be unknown
This commit is contained in:
parent
4b0d637a79
commit
a7ec8bc5fa
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue