Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Backend for collection list view
Mira Szewczyk325cba6e6bfb
diff --git a/saleor/dashboard/collection/__init__.py b/saleor/dashboard/collection/__init__.pynew file mode 100644index 0000000000..e69de29bb2diff --git a/saleor/dashboard/collection/urls.py b/saleor/dashboard/collection/urls.pynew file mode 100644index 0000000000..3ff9b03756--- /dev/null+++ b/saleor/dashboard/collection/urls.py@@ -0,0 +1,8 @@+from django.conf.urls import url++from . import views+++urlpatterns = [+ url(r'^$', views.collection_list, name='collection-list'),+]diff --git a/saleor/dashboard/collection/views.py b/saleor/dashboard/collection/views.pynew file mode 100644index 0000000000..15ffa4a29f--- /dev/null+++ b/saleor/dashboard/collection/views.py@@ -0,0 +1,14 @@+from django.template.response import TemplateResponse++from ...product.models import Collection+from ...core.utils import get_paginator_items+from ..views import staff_member_required+++@staff_member_required+def collection_list(request):+ collections = Collection.objects.all()+ collections = get_paginator_items(collections, 30, request.GET.get('page'))+ ctx = {'colections': collections}+ return TemplateResponse(request,+ 'dashboard/collection/list.html', ctx)diff --git a/saleor/dashboard/urls.py b/saleor/dashboard/urls.pyindex a285b7d0a9..42ce2bb7da 100644--- a/saleor/dashboard/urls.py+++ b/saleor/dashboard/urls.py@@ -2,6 +2,7 @@ from django.conf.urls import url, includefrom . import views as core_viewsfrom .category.urls import urlpatterns as category_urls+from .collection.urls import urlpatterns as collection_urlsfrom .customer.urls import urlpatterns as customer_urlsfrom .staff.urls import urlpatterns as staff_urlsfrom .group.urls import urlpatterns as groups_urls@@ -16,6 +17,7 @@ from .shipping.urls import urlpatterns as shipping_urlsurlpatterns = [url(r'^$', core_views.index, name='index'),url(r'^categories/', include(category_urls)),+ url(r'^collections/', include(collection_urls)),url(r'^orders/', include(order_urls)),url(r'^products/', include(product_urls)),url(r'^customers/', include(customer_urls)),diff --git a/templates/dashboard/base.html b/templates/dashboard/base.htmlindex e035a1ee76..2b32c1920f 100644--- a/templates/dashboard/base.html+++ b/templates/dashboard/base.html@@ -121,6 +121,13 @@</a></li>{% endif %}+ {% if perms.product.view_product %}+ <li class="{% block menu_collections_class %}{% endblock %}">+ <a href="{% url 'dashboard:collection-list' %}">+ {% trans "Collections" context "Dashboard side navigation link" %}+ </a>+ </li>+ {% endif %}</ul></li>{% endif %}diff --git a/templates/dashboard/collection/list.html b/templates/dashboard/collection/list.htmlnew file mode 100644index 0000000000..ef9a767d55--- /dev/null+++ b/templates/dashboard/collection/list.html@@ -0,0 +1 @@+{% extends 'dashboard/base.html' %}\ No newline at end of file