Skip to content

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

Remove queryset from attribute list

Krzysztof Wolskic3ab9a0e02a8
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index 331f6fecdf..bd7dc10c7c 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -336,7 +336,9 @@ def variants_bulk_delete(request, product_pk):
@staff_member_required
def attribute_list(request):
- attributes = ProductAttribute.objects.prefetch_related('values')
+ attributes = [
+ (attribute.pk, attribute.display, attribute.values.all())
+ for attribute in ProductAttribute.objects.prefetch_related('values')]
ctx = {'attributes': attributes}
return TemplateResponse(request, 'dashboard/product/attributes/list.html',
ctx)
diff --git a/templates/dashboard/product/attributes/list.html b/templates/dashboard/product/attributes/list.html
index c625f51e2d..619423a8a2 100644
--- a/templates/dashboard/product/attributes/list.html
+++ b/templates/dashboard/product/attributes/list.html
@@ -30,12 +30,12 @@
<div class="col s12">
{% if attributes %}
<ul class="collection list list--attributes">
- {% for attribute in attributes %}
+ {% for pk, display, values in attributes %}
<li class="collection-item list-item list--attributes-item list-item--two-lines">
- <a class="list-item-name" href="{% url 'dashboard:product-attribute-update' pk=attribute.pk %}">{{ attribute.display }}</a>
+ <a class="list-item-name" href="{% url 'dashboard:product-attribute-update' pk=pk %}">{{ display }}</a>
<p class="list-item-desc">
- {% for value in attribute.values.all %}
+ {% for value in values %}
{{ value }}{% if not forloop.last %}, {% endif %}
{% endfor %}
</p>