mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-26 08:53:46 +00:00
Formulaire de renvoie propre sur preferences
This commit is contained in:
parent
aba872b3a1
commit
9456ef3f75
1 changed files with 18 additions and 15 deletions
|
@ -69,20 +69,23 @@ def edit_options(request):
|
||||||
useroptions = EditUserOptionsForm(request.POST or None, instance=useroptions_instance)
|
useroptions = EditUserOptionsForm(request.POST or None, instance=useroptions_instance)
|
||||||
machineoptions = EditMachineOptionsForm(request.POST or None, instance=machineoptions_instance)
|
machineoptions = EditMachineOptionsForm(request.POST or None, instance=machineoptions_instance)
|
||||||
generaloptions = EditGeneralOptionsForm(request.POST or None, instance=generaloptions_instance)
|
generaloptions = EditGeneralOptionsForm(request.POST or None, instance=generaloptions_instance)
|
||||||
if useroptions.is_valid():
|
if useroptions.is_valid() or machineoptions.is_valid() or generaloptions.is_valid():
|
||||||
with transaction.atomic(), reversion.create_revision():
|
if useroptions.is_valid():
|
||||||
useroptions.save()
|
with transaction.atomic(), reversion.create_revision():
|
||||||
reversion.set_user(request.user)
|
useroptions.save()
|
||||||
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in useroptions.changed_data))
|
reversion.set_user(request.user)
|
||||||
if machineoptions.is_valid():
|
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in useroptions.changed_data))
|
||||||
with transaction.atomic(), reversion.create_revision():
|
if machineoptions.is_valid():
|
||||||
machineoptions.save()
|
with transaction.atomic(), reversion.create_revision():
|
||||||
reversion.set_user(request.user)
|
machineoptions.save()
|
||||||
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in machineoptions.changed_data))
|
reversion.set_user(request.user)
|
||||||
if generaloptions.is_valid():
|
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in machineoptions.changed_data))
|
||||||
with transaction.atomic(), reversion.create_revision():
|
if generaloptions.is_valid():
|
||||||
generaloptions.save()
|
with transaction.atomic(), reversion.create_revision():
|
||||||
reversion.set_user(request.user)
|
generaloptions.save()
|
||||||
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in generaloptions.changed_data))
|
reversion.set_user(request.user)
|
||||||
|
reversion.set_comment("Champs modifié(s) : %s" % ', '.join(field for field in generaloptions.changed_data))
|
||||||
|
messages.success(request, "Préférences modifiées")
|
||||||
|
return redirect("/preferences/")
|
||||||
return form({'useroptions': useroptions, 'machineoptions': machineoptions, 'generaloptions': generaloptions}, 'preferences/edit_preferences.html', request)
|
return form({'useroptions': useroptions, 'machineoptions': machineoptions, 'generaloptions': generaloptions}, 'preferences/edit_preferences.html', request)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue