mirror of
https://github.com/pretix/pretix.git
synced 2026-05-03 14:54:04 +00:00
API: Prefetch customer in order list view (#3768)
Before this change, each order row needed an additional database query just to resolve the customer id (integer) to customer identifier (string). With this change, django does a database JOIN.
This commit is contained in:
committed by
GitHub
parent
f543cf2da5
commit
c5ede32649
@@ -222,6 +222,8 @@ class OrderViewSetMixin:
|
||||
qs = qs.prefetch_related('refunds', 'refunds__payment')
|
||||
if 'invoice_address' not in self.request.GET.getlist('exclude'):
|
||||
qs = qs.select_related('invoice_address')
|
||||
if 'customer' not in self.request.GET.getlist('exclude'):
|
||||
qs = qs.select_related('customer')
|
||||
|
||||
qs = qs.prefetch_related(self._positions_prefetch(self.request))
|
||||
return qs
|
||||
|
||||
Reference in New Issue
Block a user