diff --git a/wiki_groups/templates/wiki_groups/graph.html b/wiki_groups/templates/wiki_groups/list.html
similarity index 87%
rename from wiki_groups/templates/wiki_groups/graph.html
rename to wiki_groups/templates/wiki_groups/list.html
index f2cfea7..b20c4e8 100644
--- a/wiki_groups/templates/wiki_groups/graph.html
+++ b/wiki_groups/templates/wiki_groups/list.html
@@ -4,6 +4,16 @@
{% block wiki_site_title %}Groupes - WikiENS{% endblock %}
{% block wiki_contents %}
+
Liste des groupes du wiki
+
+
+
+
+ {% for id, name in groups %}
+ - {{name}}
+ {% endfor %}
+
+
Graphe des groupes du wiki
diff --git a/wiki_groups/urls.py b/wiki_groups/urls.py
index 851a62d..89e4c2f 100644
--- a/wiki_groups/urls.py
+++ b/wiki_groups/urls.py
@@ -1,9 +1,9 @@
from django.urls import path
-from wiki_groups import views
+from wiki_groups import views
app_name = "wiki_groups"
urlpatterns = [
+ path("", views.GroupList.as_view(), name="list"),
path("dot_graph", views.dot_graph, name="dot_graph"),
- path("graph", views.graph, name="graph"),
]
diff --git a/wiki_groups/views.py b/wiki_groups/views.py
index c5200cd..3e4f92f 100644
--- a/wiki_groups/views.py
+++ b/wiki_groups/views.py
@@ -1,5 +1,5 @@
from django.http import HttpResponse
-from django.views.generic import TemplateView
+from django.views.generic import ListView
from wiki_groups.models import WikiGroup
@@ -22,4 +22,12 @@ def dot_graph(request):
return response
-graph = TemplateView.as_view(template_name="wiki_groups/graph.html")
+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(
+ "django_group__name"
+ )