8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Merge branch 'fix_state' into 'master'

Fix le changement d'etat de l'user

See merge request federez/re2o!113
This commit is contained in:
chirac 2018-04-07 22:16:05 +02:00
commit 99928c885b

View file

@ -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.changed_data:
if state.cleaned_data['state'] == User.STATE_ARCHIVE: if state.cleaned_data['state'] == User.STATE_ARCHIVE:
user.archive() user.archive()
elif state.cleaned_data['state'] == User.STATE_ACTIVE: elif state.cleaned_data['state'] == User.STATE_ACTIVE:
user.unarchive() user.unarchive()
elif state.cleaned_data['state'] == User.STATE_DISABLED: state.save()
user.state = User.STATE_DISABLED
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',