Fix sort of payments and refunds.

Now sorted by reverse date and reverse id for same date.
This commit is contained in:
Gabriel Augendre 2016-08-17 17:37:46 +02:00
parent 6cffd58a8d
commit 37988b7a91

View file

@ -13,7 +13,7 @@ from refunding.models import Payment, Refund
@login_required
def latest_refunds(request):
refunds = Refund.objects.all().order_by('-date')[:20]
refunds = Refund.objects.all().order_by('-date', '-id')[:20]
context = {
'refunds': refunds,
'default_nothing': 'No refund to show.'
@ -89,7 +89,7 @@ def refund_delete(request, pk):
@login_required
def not_refunded_payments(request):
payments = Payment.objects.filter(refund=None).order_by('-date')
payments = Payment.objects.filter(refund=None).order_by('-date', '-id')
value_sum = payments.aggregate(Sum('value')).get('value__sum')
if value_sum:
value_sum /= 100