Skip to content

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

Add list permission in group list

michal7eb023910806
diff --git a/saleor/dashboard/group/views.py b/saleor/dashboard/group/views.py
index a996e344f5..355160ebcd 100644
--- a/saleor/dashboard/group/views.py
+++ b/saleor/dashboard/group/views.py
@@ -12,7 +12,8 @@ from .forms import GroupPermissionsForm
@staff_member_required
def group_list(request):
- groups = Group.objects.all()
+ groups = [{'name': group, 'permissions': group.permissions.all()}
+ for group in Group.objects.all()]
ctx = {'groups': groups}
return TemplateResponse(request, 'dashboard/group/list.html', ctx)
diff --git a/saleor/dashboard/product/views.py b/saleor/dashboard/product/views.py
index 7f9f4fad18..cb83bcda1f 100644
--- a/saleor/dashboard/product/views.py
+++ b/saleor/dashboard/product/views.py
@@ -1,12 +1,8 @@
from __future__ import unicode_literals
from django.contrib import messages
-
-from django.http import JsonResponse
-
from django.contrib.auth.decorators import permission_required
-from django.core.urlresolvers import reverse
-
+from django.http import JsonResponse
from django.shortcuts import get_object_or_404, redirect
from django.template.response import TemplateResponse
from django.utils.http import is_safe_url
diff --git a/templates/dashboard/group/list.html b/templates/dashboard/group/list.html
index 0f6e496bf5..5040b56509 100644
--- a/templates/dashboard/group/list.html
+++ b/templates/dashboard/group/list.html
@@ -35,11 +35,13 @@
<ul class="collection list">
{% for group in groups %}
<li class="collection-item list-item">
- <a class="list-item-name" href="{% url 'dashboard:group-details' pk=group.pk %}">
+ <a class="list-item-name" href="{% url 'dashboard:group-details' pk=group.name.pk %}">
{{ group.name }}
<p class="list-item-desc">
<span>
-
+ {% for permission in group.permissions %}
+ {{ permission.name }},
+ {% endfor %}
</span>
</p>
</a>