home ohne Pfand
This commit is contained in:
parent
47267b8213
commit
dddb18cd87
|
@ -7,9 +7,12 @@ from buyable.models import Purchase, Buyable
|
|||
|
||||
@login_required
|
||||
def startpage(request):
|
||||
allMost = Purchase.objects.values('buyable__name').annotate(num_buys=Count('buyable')).order_by('-num_buys')
|
||||
usersMost = Purchase.objects.values('buyable__name').filter(order__user=request.user.id).annotate(num_buys=Count('buyable')).order_by('-num_buys')
|
||||
usersLast = Purchase.objects.values('buyable__name').filter(order__user=request.user.id).order_by('-order__dateTime')
|
||||
''' Diese Funktion wird wahrscheinlich viel Last erzeugen, da
|
||||
sie ueber mehrere Tabellen joined,filtered und wieder reduced.
|
||||
'''
|
||||
allMost = Purchase.objects.filter(isDeposit=False).values('buyable__name').annotate(num_buys=Count('buyable')).order_by('-num_buys')
|
||||
usersMost = Purchase.objects.filter(isDeposit=False).values('buyable__name').filter(order__user=request.user.id).annotate(num_buys=Count('buyable')).order_by('-num_buys')
|
||||
usersLast = Purchase.objects.filter(isDeposit=False).values('buyable__name').filter(order__user=request.user.id).order_by('-order__dateTime')
|
||||
return render_to_response("main/startpage.html", {'allMost' : allMost,'usersMost': usersMost, 'usersLast' : usersLast}, RequestContext(request))
|
||||
|
||||
def register(request):
|
||||
|
|
Loading…
Reference in New Issue