Optimized some SQL queries

This commit is contained in:
Raphael Michel
2016-03-22 12:42:30 +01:00
parent 60506f68f0
commit 6280e06e7c

View File

@@ -120,7 +120,7 @@ class OrderDetail(OrderView):
and self.order.status == Order.STATUS_PAID and self.order.status == Order.STATUS_PAID
) )
ctx['payment'] = self.payment_provider.order_control_render(self.request, self.object) ctx['payment'] = self.payment_provider.order_control_render(self.request, self.object)
ctx['invoices'] = list(self.order.invoices.all()) ctx['invoices'] = list(self.order.invoices.all().select_related('event'))
return ctx return ctx
def get_items(self): def get_items(self):
@@ -131,7 +131,7 @@ class OrderDetail(OrderView):
).select_related( ).select_related(
'item', 'variation' 'item', 'variation'
).prefetch_related( ).prefetch_related(
'item__questions', 'answers' 'item__questions', 'answers', 'answers__question'
) )
# Group items of the same variation # Group items of the same variation