diff --git a/wiki_groups/templates/wiki_groups/list.html b/wiki_groups/templates/wiki_groups/list.html index b20c4e8..ecf293e 100644 --- a/wiki_groups/templates/wiki_groups/list.html +++ b/wiki_groups/templates/wiki_groups/list.html @@ -4,44 +4,49 @@ {% block wiki_site_title %}Groupes - WikiENS{% endblock %} {% block wiki_contents %} -

Liste des groupes du wiki

+

+ Liste des groupes du wiki + {% if request.user.is_staff or request.user.managed_groups.exists %} + + Liste des groupes gérés + + {% endif %} +

+
-
+ - +

Graphe des groupes du wiki

+
-

Graphe des groupes du wiki

+
+
-
+

+ Les flèches représentent l'inclusion : A -> B signifie que + le groupe A est contenu dans le groupe B. +

-
+ + + - - + } + }; + xhttp.open('GET', '{% url 'wiki_groups:dot_graph' %}', true); + xhttp.send(); + + {% endblock %} diff --git a/wiki_groups/views.py b/wiki_groups/views.py index bba5db7..db751b9 100644 --- a/wiki_groups/views.py +++ b/wiki_groups/views.py @@ -2,7 +2,7 @@ from django.contrib.auth import get_user_model from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin from django.http import HttpResponse, HttpResponseRedirect from django.urls import reverse, reverse_lazy -from django.views.generic import DetailView, ListView, RedirectView, TemplateView +from django.views.generic import DetailView, ListView, RedirectView from django.views.generic.detail import SingleObjectMixin from django.views.generic.edit import BaseFormView @@ -33,10 +33,9 @@ def dot_graph(request): class GroupList(ListView): template_name = "wiki_groups/list.html" model = WikiGroup - context_object_name = "groups" def get_queryset(self): - return WikiGroup.objects.values_list("id", "django_group__name").order_by( + return WikiGroup.objects.select_related("django_group").order_by( "django_group__name" )