From 8ea20f93dd77a30a20ce046be0d9d45d73d0f692 Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Sun, 31 Dec 2017 19:50:45 +0100 Subject: [PATCH] Vue d'edition des droits fully fonctionnelle... --- users/views.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/users/views.py b/users/views.py index f583bfab..3663b932 100644 --- a/users/views.py +++ b/users/views.py @@ -248,11 +248,16 @@ def groups(request, user, userid): group = GroupForm(request.POST or None, instance=user) if group.is_valid(): with transaction.atomic(), reversion.create_revision(): - messages.success(request, "Groupes changés avec succès") - return redirect(reverse( - 'users:profil', - kwargs={'userid':str(userid)} + reversion.set_user(request.user) + reversion.set_comment("Champs modifié(s) : %s" % ', '.join( + field for field in group.changed_data )) + group.save() + messages.success(request, "Groupes changés avec succès") + return redirect(reverse( + 'users:profil', + kwargs={'userid':str(userid)} + )) return form({'userform': group}, 'users/user.html', request)