From 37988b7a91a63d963b0b9cbee2a086b6e938b7fa Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Wed, 17 Aug 2016 17:37:46 +0200 Subject: [PATCH] Fix sort of payments and refunds. Now sorted by reverse date and reverse id for same date. --- refunding/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/refunding/views.py b/refunding/views.py index c6c98c0..650c183 100644 --- a/refunding/views.py +++ b/refunding/views.py @@ -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