From 62858b0f6ed4035dbf1b6dc8a1e2f675cdf19f00 Mon Sep 17 00:00:00 2001 From: Christopher Neugebauer Date: Wed, 5 Oct 2016 12:28:43 -0700 Subject: [PATCH] Optimises some queries on attendee profile page --- registrasion/reporting/views.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/registrasion/reporting/views.py b/registrasion/reporting/views.py index d17149cc..7a74728d 100644 --- a/registrasion/reporting/views.py +++ b/registrasion/reporting/views.py @@ -454,7 +454,8 @@ def attendee(request, form, user_id=None): # Credit Notes credit_notes = commerce.CreditNote.objects.filter( invoice__user=attendee.user, - ) + ).select_related("invoice", "creditnoteapplication", "creditnoterefund") + reports.append(QuerysetReport( "Credit Notes", ["id", "status", "value"], @@ -465,7 +466,8 @@ def attendee(request, form, user_id=None): # All payments payments = commerce.PaymentBase.objects.filter( invoice__user=attendee.user, - ) + ).select_related("invoice") + reports.append(QuerysetReport( "Payments", ["invoice__id", "id", "reference", "amount"],