mirror of
https://github.com/nanoy42/coope
synced 2024-11-05 01:16:28 +00:00
Liaison avec les utilisateurs
This commit is contained in:
parent
e5456b4d21
commit
946098f83b
5 changed files with 49 additions and 2 deletions
34
gestion/templates/gestion/pintes_user_list.html
Normal file
34
gestion/templates/gestion/pintes_user_list.html
Normal file
|
@ -0,0 +1,34 @@
|
|||
{% extends 'base.html' %}
|
||||
{% block entete %}Gestion des produits{% endblock %}
|
||||
{% block navbar%}
|
||||
<ul>
|
||||
<li><a href="#first">Liste des utilisateurs n'ayant pas rendu leur pinte</a></li>
|
||||
</ul>
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
<section id="first" class="main">
|
||||
<header class="major">
|
||||
<h2>Liste des utilisateurs n'ayant pas rendu leur pinte</h2>
|
||||
</header>
|
||||
<div class="table-wrapper">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Utilisateur</th>
|
||||
<th>Profil</th>
|
||||
<th>Nombre de pintes non rendues</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for user in users %}
|
||||
<tr>
|
||||
<td>{{ user }}</td>
|
||||
<td><a href="{% url 'users:profile' user.pk %}" class="button small">Profil</a></td>
|
||||
<td>{{ user.pintes_owned_currently.count }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
{% endblock %}
|
|
@ -74,6 +74,9 @@
|
|||
{% if perms.gestion.view_pinte %}
|
||||
<li><a href="{% url 'gestion:pintesList' %}">Lister les pintes</a></li>
|
||||
{% endif %}
|
||||
{% if perms.auth.view_user %}
|
||||
<li><a href="{% url 'gestion:pintesUserList' %}">Lister les utilisateurs n'ayant pas rendu leurs pintes</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
|
|
@ -37,6 +37,7 @@ urlpatterns = [
|
|||
path('releasePintes', views.release_pintes, name="releasePintes"),
|
||||
path('pintesList', views.pintes_list, name="pintesList"),
|
||||
path('release/<int:pinte_pk>', views.release, name="release"),
|
||||
path('pintesUserList', views.pintes_user_list, name="pintesUserList"),
|
||||
path('products-autocomplete', views.ProductsAutocomplete.as_view(), name="products-autocomplete"),
|
||||
path('kegs-positive-autocomplete', views.KegPositiveAutocomplete.as_view(), name="kegs-positive-autocomplete"),
|
||||
path('kegs-active-autocomplete', views.KegActiveAutocomplete.as_view(), name="kegs-active-autocomplete"),
|
||||
|
|
|
@ -980,4 +980,12 @@ def release_pintes(request):
|
|||
def pintes_list(request):
|
||||
free_pintes = Pinte.objects.filter(current_owner=None)
|
||||
taken_pintes = Pinte.objects.exclude(current_owner=None)
|
||||
return render(request, "gestion/pintes_list.html", {"free_pintes": free_pintes, "taken_pintes": taken_pintes})
|
||||
return render(request, "gestion/pintes_list.html", {"free_pintes": free_pintes, "taken_pintes": taken_pintes})
|
||||
|
||||
@active_required
|
||||
@login_required
|
||||
@permission_required('auth.view_user')
|
||||
def pintes_user_list(request):
|
||||
pks = [x.pk for x in User.objects.all() if x.profile.nb_pintes > 0]
|
||||
users = User.objects.filter(pk__in=pks)
|
||||
return render(request, "gestion/pintes_user_list.html", {"users": users})
|
|
@ -42,7 +42,8 @@
|
|||
<li><b>Groupe(s) : </b>{{user.groups.all|join:", "}}</li>
|
||||
<li>
|
||||
<b>Position au classement : </b>{{user.profile.rank}}<span class="tabulation">
|
||||
<b>Quantité d'alcool ingérée : </b>{{user.profile.alcohol | floatformat:"-2"}} kg</span>
|
||||
<b>Quantité d'alcool ingérée : </b>{{user.profile.alcohol | floatformat:"-2"}} kg</span><span class="tabulation">
|
||||
<b>Nombre de pinte(s) non rendue(s) : </b> {{ user.pintes_owned_currently.count }} </span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue