Skip to content

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

Improve attributes list

Paweł Kowalewskif72233e05eef
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index 00fbcc60d2..202a94d206 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -227,7 +227,7 @@ def variants_bulk_delete(request, product_pk):
@staff_member_required
def attribute_list(request):
- attributes = ProductAttribute.objects.all()
+ attributes = ProductAttribute.objects.prefetch_related('values')
ctx = {'attributes': attributes}
return TemplateResponse(request, 'dashboard/product/attributes/list.html',
ctx)
diff --git a/saleor/dashboard/templates/dashboard/index.html b/saleor/dashboard/templates/dashboard/index.html
index 71c902a998..5eec881cde 100644
--- a/saleor/dashboard/templates/dashboard/index.html
+++ b/saleor/dashboard/templates/dashboard/index.html
@@ -64,7 +64,9 @@
<ul class="list">
{% for product in low_stock %}
<li class="list-item">
- <a class="list-item-name list-item-name--single" href="{% url "dashboard:product-update" pk=product.pk %}#stock">{{ product }}</a>
+ <a class="list-item-name list-item-name--single" href="{% url "dashboard:product-update" pk=product.pk %}#stock">
+ {{ product }} ({{ product.total_stock }})
+ </a>
</li>
{% endfor %}
</ul>
diff --git a/saleor/dashboard/templates/dashboard/product/attributes/list.html b/saleor/dashboard/templates/dashboard/product/attributes/list.html
index 35befd3543..f3d3045295 100644
--- a/saleor/dashboard/templates/dashboard/product/attributes/list.html
+++ b/saleor/dashboard/templates/dashboard/product/attributes/list.html
@@ -29,8 +29,14 @@
{% if attributes %}
<ul class="collection list list--attributes">
{% for attribute in attributes %}
- <li class="collection-item list-item list--attributes-item">
- <a href="{% url 'dashboard:product-attribute-update' pk=attribute.pk %}">{{ attribute.display }}</a>
+ <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>
+
+ <p class="list-item-desc">
+ {% for value in attribute.values.all %}
+ {{ value }}{% if not forloop.last %}, {% endif %}
+ {% endfor %}
+ </p>
</li>
{% endfor %}
</ul>