|
|
|
@ -1,6 +1,7 @@
|
|
|
|
|
from django.shortcuts import render_to_response
|
|
|
|
|
from django.template import RequestContext
|
|
|
|
|
from django.contrib.auth.decorators import login_required
|
|
|
|
|
from django.db.models import Q
|
|
|
|
|
from django.http import HttpResponseRedirect
|
|
|
|
|
from models import Transaction, TransactionType, VirtualTransaction
|
|
|
|
|
from forms import TransactionForm, VirtualTransactionForm
|
|
|
|
@ -11,7 +12,7 @@ def overview(request):
|
|
|
|
|
""" Creates an overview over the users transactions, also handles adding and transfering money. """
|
|
|
|
|
# create history
|
|
|
|
|
history = Transaction.objects.filter(user=request.user).order_by("-dateTime")
|
|
|
|
|
|
|
|
|
|
vhistory = VirtualTransaction.objects.filter(Q(user=request.user) | Q(recipient=request.user)).order_by("-dateTime")
|
|
|
|
|
# create forms
|
|
|
|
|
form = TransactionForm()
|
|
|
|
|
vform = VirtualTransactionForm()
|
|
|
|
@ -39,5 +40,5 @@ def overview(request):
|
|
|
|
|
vtransacted = True
|
|
|
|
|
else:
|
|
|
|
|
error = True
|
|
|
|
|
return render_to_response("transaction/overview.html", {'history': history, 'form': form, 'transacted': transacted, 'error': error, 'vform': vform, 'vtransacted': vtransacted, 'verror': verror}, RequestContext(request))
|
|
|
|
|
return render_to_response("transaction/overview.html", {'history': history, 'vhistory': vhistory, 'form': form, 'transacted': transacted, 'error': error, 'vform': vform, 'vtransacted': vtransacted, 'verror': verror}, RequestContext(request))
|
|
|
|
|
|
|
|
|
|