Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Display all stock locations view
Mira Szewczykf1aeb934ed9c
diff --git a/saleor/dashboard/product/urls.py b/saleor/dashboard/product/urls.pyindex 7bbec3e85e..279af8859b 100644--- a/saleor/dashboard/product/urls.py+++ b/saleor/dashboard/product/urls.py@@ -51,4 +51,7 @@ urlpatterns = [views.attribute_edit, name='product-attribute-add'),url(r'attributes/(?P<pk>[0-9]+)/delete/$',views.attribute_delete, name='product-attribute-delete'),++ url(r'stocklocations/$', views.stock_location_list,+ name='product-stock-location-list'),]diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.pyindex 8e0220da55..f1010dbf74 100644--- a/saleor/dashboard/product/views.py+++ b/saleor/dashboard/product/views.py@@ -11,7 +11,7 @@ from django.views.decorators.http import require_http_methodsfrom . import formsfrom ...core.utils import get_paginator_itemsfrom ...product.models import (Product, ProductAttribute, ProductImage,- ProductVariant, Stock)+ ProductVariant, Stock, StockLocation)from ..views import staff_member_required@@ -274,3 +274,11 @@ def attribute_delete(request, pk):ctx = {'attribute': attribute}return TemplateResponse(request, 'dashboard/product/attributes/modal_confirm_delete.html', ctx)+++@staff_member_required+def stock_location_list(request):+ stock_locations = StockLocation.objects.all()+ ctx = {'locations': stock_locations}+ return TemplateResponse(+ request, 'dashboard/product/stock_locations/list.html', ctx)diff --git a/templates/dashboard/base.html b/templates/dashboard/base.htmlindex b6f6d9e7c0..7ecfd1a7b5 100644--- a/templates/dashboard/base.html+++ b/templates/dashboard/base.html@@ -38,6 +38,7 @@<li class="{% block menu_products_class %}{% endblock %}"><a href="{% url 'dashboard:product-list' %}">{% trans "Products" %}</a></li><li class="{% block menu_attributes_class %}{% endblock %}"><a href="{% url 'dashboard:product-attributes' %}">{% trans "Attributes" %}</a></li><li class="{% block menu_categories_class %}{% endblock %}"><a href="{% url 'dashboard:category-list' %}">{% trans "Categories" %}</a></li>+ <li class="{% block menu_categories_class %}{% endblock %}"><a href="{% url 'dashboard:product-stock-location-list' %}">{% trans "Stock locations" %}</a></li></ul></li><li class="side-nav-section">diff --git a/templates/dashboard/product/stock_locations/list.html b/templates/dashboard/product/stock_locations/list.htmlnew file mode 100644index 0000000000..eca4cf71b9--- /dev/null+++ b/templates/dashboard/product/stock_locations/list.html@@ -0,0 +1,44 @@+{% extends 'dashboard/base.html' %}+{% load i18n %}+{% load materializecss %}+{% load staticfiles %}++{% block title %}{% trans "Stock locations" %} - {{ block.super }}{% endblock %}++{% block body_class %}body-locations{% endblock %}++{% block header_extra %}+ <div class="fixed-action-btn">+ <a class="btn-fab btn-floating btn-large waves-effect waves-light teal"+ href="{% url 'dashboard:product-attribute-add' %}" title="{% trans "Add stock location" %}">+ <i class="material-icons">add</i>+ </a>+ </div>+{% endblock %}++{% block breadcrumbs %}+ <ul class="breadcrumbs">+ <li>{% trans "Stock locations" %}</li>+ </ul>+{% endblock %}++{% block menu_catalogue_class %} active{% endblock %}+++{% block content %}+ <div class="row">+ <div class="col s12">+ {% if locations %}+ <ul class="collection list list--attributes">+ {% for location in locations %}+ <li class="collection-item list-item list--attributes-item list-item--two-lines">+ <a class="list-item-name" href="">{{ location }}</a>+ </li>+ {% endfor %}+ </ul>+ {% else %}+ <p>{% trans "No attributes found." %}</p>+ {% endif %}+ </div>+ </div>+{% endblock %}\ No newline at end of file