Display the list of groups at /_groups/

This commit is contained in:
Martin Pépin 2021-01-06 20:17:25 +01:00 committed by Tom Hubrecht
parent ef00b63053
commit cc50d540c3
3 changed files with 20 additions and 2 deletions

View file

@ -4,6 +4,16 @@
{% block wiki_site_title %}Groupes - WikiENS{% endblock %}
{% block wiki_contents %}
<h2>Liste des groupes du wiki</h2>
<hr />
<ul>
{% for id, name in groups %}
<li>{{name}}</li>
{% endfor %}
</ul>
<h2>Graphe des groupes du wiki</h2>
<hr />

View file

@ -4,8 +4,8 @@ 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"),
path("managed", views.ManagedGroupsView.as_view(), name="managed-groups"),
path("<int:pk>", views.WikiGroupView.as_view(), name="admin-group"),
path(

View file

@ -30,7 +30,15 @@ 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"
)
class WikiGroupMixin(SingleObjectMixin, UserPassesTestMixin):