Vue détaillée des groupes
This commit is contained in:
parent
811f5cb53a
commit
6a6b5a1b97
4 changed files with 50 additions and 2 deletions
41
wiki_groups/templates/wiki_groups/detail.html
Normal file
41
wiki_groups/templates/wiki_groups/detail.html
Normal 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 %}
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
<ul>
|
||||
{% for id, name in groups %}
|
||||
<li>{{name}}</li>
|
||||
<li><a href="{% url "wiki_groups:detail" id %}">{{ name }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -6,4 +6,5 @@ app_name = "wiki_groups"
|
|||
urlpatterns = [
|
||||
path("", views.GroupList.as_view(), name="list"),
|
||||
path("dot_graph", views.dot_graph, name="dot_graph"),
|
||||
path("detail/<int:pk>", views.GroupDetail.as_view(), name="detail"),
|
||||
]
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.http import HttpResponse
|
||||
from django.views.generic import ListView
|
||||
from django.views.generic import DetailView, ListView
|
||||
|
||||
from wiki_groups.models import WikiGroup
|
||||
|
||||
|
@ -31,3 +31,9 @@ class GroupList(ListView):
|
|||
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"
|
||||
|
|
Loading…
Reference in a new issue