Vue détaillée d'un groupe #20

Closed
mpepin wants to merge 2 commits from kerl/group_management into main
4 changed files with 70 additions and 4 deletions

View file

@ -0,0 +1,41 @@
{% extends "wiki/base.html" %}
{% load staticfiles %}
{% block wiki_site_title %}Groups - WikiENS{% endblock %}
{% block wiki_contents %}
<h2>Informations sur le groupe : {{ group }}</h2>
<hr />
{% if group.users.exists %}
<h3>Membres du groupe</h3>
<hr />
<ul>
{% for user in group.users.all %}
<li>{{ user }}</li>
{% endfor %}
</ul>
{% endif %}
{% if group.includes_groups.exists %}
<h3>{{ group }} contient les groupes suivants</h3>
<hr />
<ul>
{% for g in group.includes_groups.all %}
<li><a href="{% url "wiki_groups:detail" g.id %}">{{ g }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% if group.included_in_groups.exists %}
<h3>{{ group }} est contenu dans les groupes suivants</h3>
<hr />
<ul>
{% for g in group.included_in_groups.all %}
<li><a href="{% url "wiki_groups:detail" g.id %}">{{ g }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}

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><a href="{% url "wiki_groups:detail" id %}">{{ name }}</a></li>
{% endfor %}
</ul>
<h2>Graphe des groupes du wiki</h2>
<hr />

View file

@ -1,9 +1,10 @@
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"),
path("detail/<int:pk>", views.GroupDetail.as_view(), name="detail"),
]

View file

@ -1,5 +1,5 @@
from django.http import HttpResponse
from django.views.generic import TemplateView
from django.views.generic import DetailView, ListView
from wiki_groups.models import WikiGroup
@ -22,4 +22,18 @@ 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 GroupDetail(DetailView):
template_name = "wiki_groups/detail.html"
model = WikiGroup
context_object_name = "group"