mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 11:23:10 +00:00
Fix le changement d'etat de l'user
This commit is contained in:
parent
b49866d9ee
commit
bb6b19f574
1 changed files with 6 additions and 8 deletions
|
@ -198,14 +198,12 @@ def state(request, user, userid):
|
||||||
need droit bureau """
|
need droit bureau """
|
||||||
state = StateForm(request.POST or None, instance=user)
|
state = StateForm(request.POST or None, instance=user)
|
||||||
if state.is_valid():
|
if state.is_valid():
|
||||||
if state.cleaned_data['state'] == User.STATE_ARCHIVE:
|
if state.changed_data:
|
||||||
user.archive()
|
if state.cleaned_data['state'] == User.STATE_ARCHIVE:
|
||||||
elif state.cleaned_data['state'] == User.STATE_ACTIVE:
|
user.archive()
|
||||||
user.unarchive()
|
elif state.cleaned_data['state'] == User.STATE_ACTIVE:
|
||||||
elif state.cleaned_data['state'] == User.STATE_DISABLED:
|
user.unarchive()
|
||||||
user.state = User.STATE_DISABLED
|
state.save()
|
||||||
if user.changed_data:
|
|
||||||
user.save()
|
|
||||||
messages.success(request, "Etat changé avec succès")
|
messages.success(request, "Etat changé avec succès")
|
||||||
return redirect(reverse(
|
return redirect(reverse(
|
||||||
'users:profil',
|
'users:profil',
|
||||||
|
|
Loading…
Reference in a new issue