mirror of
https://github.com/nanoy42/coope
synced 2024-11-22 03:13:12 +00:00
Modification dans la liste
This commit is contained in:
parent
729434c1fb
commit
e01fb202ff
3 changed files with 17 additions and 0 deletions
|
@ -17,6 +17,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th>Utilisateur</th>
|
<th>Utilisateur</th>
|
||||||
<th>Profil</th>
|
<th>Profil</th>
|
||||||
|
{% if perms.auth.change_user %}
|
||||||
|
<th>Activer / Désactiver</th>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@ -24,6 +27,9 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ user }}</td>
|
<td>{{ user }}</td>
|
||||||
<td><a class="button small" href="{% url 'users:profile' user.pk %}">Profil</a></td>
|
<td><a class="button small" href="{% url 'users:profile' user.pk %}">Profil</a></td>
|
||||||
|
{% if perms.auth.change_user %}
|
||||||
|
<td><a class="button small" href="{% url 'users:switchActivateUser' user.pk %}">{{ user.is_active | yesno:"Désa,A"}}ctiver</a></td>
|
||||||
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|
|
@ -44,4 +44,5 @@ urlpatterns = [
|
||||||
path('allConsumptions/<int:pk>/<int:page>', views.all_consumptions, name="allConsumptions"),
|
path('allConsumptions/<int:pk>/<int:page>', views.all_consumptions, name="allConsumptions"),
|
||||||
path('allMenus/<int:pk>/<int:page>', views.all_menus, name="allMenus"),
|
path('allMenus/<int:pk>/<int:page>', views.all_menus, name="allMenus"),
|
||||||
path('exportCSV', views.export_csv, name="exportCSV"),
|
path('exportCSV', views.export_csv, name="exportCSV"),
|
||||||
|
path('switchActivateUser/<int:pk>', views.switch_activate_user, name="switchActivateUser"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -487,6 +487,16 @@ def all_menus(request, pk, page):
|
||||||
menus = paginator.get_page(page)
|
menus = paginator.get_page(page)
|
||||||
return render(request, "users/all_menus.html", {"menus": menus, "user":user})
|
return render(request, "users/all_menus.html", {"menus": menus, "user":user})
|
||||||
|
|
||||||
|
@active_required
|
||||||
|
@login_required
|
||||||
|
@permission_required('auth.change_user')
|
||||||
|
def switch_activate_user(request, pk):
|
||||||
|
user = get_object_or_404(User, pk=pk)
|
||||||
|
user.is_active = 1 - user.is_active
|
||||||
|
user.save()
|
||||||
|
messages.success(request, "Le statut de l'utilisateur a bien été changé")
|
||||||
|
return HttpResponseRedirect(request.META.get('HTTP_REFERER', '/'))
|
||||||
|
|
||||||
########## Groups ##########
|
########## Groups ##########
|
||||||
|
|
||||||
@active_required
|
@active_required
|
||||||
|
|
Loading…
Reference in a new issue