Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display collections in collection-list view
Mira Szewczyk69960a27a663
diff --git a/saleor/dashboard/collection/views.py b/saleor/dashboard/collection/views.pyindex 6e6929c166..ac37cbc87d 100644--- a/saleor/dashboard/collection/views.py+++ b/saleor/dashboard/collection/views.py@@ -11,7 +11,7 @@ from .forms import CollectionForm@staff_member_requireddef collection_list(request):- collections = Collection.objects.all()+ collections = Collection.objects.prefetch_related('products').all()collections = get_paginator_items(collections, 30, request.GET.get('page'))ctx = {'collections': collections}return TemplateResponse(request,diff --git a/templates/dashboard/collection/list.html b/templates/dashboard/collection/list.htmlindex 141487a327..2877619f3b 100644--- a/templates/dashboard/collection/list.html+++ b/templates/dashboard/collection/list.html@@ -27,8 +27,20 @@<div class="row"><div class="col s12">{% if collections %}- {% for collection in collections %}- {% endfor %}+ <ul class="collection list">+ {% for collection in collections %}+ <li class="collection-item list-item list-item--two-lines">+ <a class="list-item-name" href="#">+ {{ collection }}+ </a>+ <p class="list-item-desc">+ <span>+ {% trans "Products in collection:" %} {{ collection.products.count }}+ </span>+ </p>+ </li>+ {% endfor %}+ </ul>{% else %}<p>{% trans "No collections" %}</p>{% endif %}