Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Reduce number of queries on order details

Pacu2e0656cafeec1
diff --git a/saleor/dashboard/order/views.py b/saleor/dashboard/order/views.py
index 871ae4d718..b5ee82210b 100644
--- a/saleor/dashboard/order/views.py
+++ b/saleor/dashboard/order/views.py
@@ -112,7 +112,7 @@ def remove_draft_order(request, order_pk):
def order_details(request, order_pk):
qs = Order.objects.select_related(
'user', 'shipping_address', 'billing_address').prefetch_related(
- 'notes__user', 'payments', 'history__user', 'lines__product',
+ 'notes__user', 'payments', 'history__user', 'lines__variant__product',
'fulfillments__lines')
order = get_object_or_404(qs, pk=order_pk)
all_payments = order.payments.exclude(status=PaymentStatus.INPUT)
diff --git a/templates/dashboard/product/product_attribute/detail.html b/templates/dashboard/product/product_attribute/detail.html
index ca3741f88d..74f54e46b3 100644
--- a/templates/dashboard/product/product_attribute/detail.html
+++ b/templates/dashboard/product/product_attribute/detail.html
@@ -79,7 +79,7 @@
</tr>
</thead>
<tbody>
- {% for value in attribute.values.all %}
+ {% for value in attribute.values %}
<tr>
<td>
{{ value.name }}