forked from DGNum/gestioCOF
Proper use of messages in profile edit
This commit is contained in:
parent
1fe1b94afc
commit
b7ecac3db6
2 changed files with 3 additions and 6 deletions
|
@ -5,9 +5,6 @@
|
|||
|
||||
{% block realcontent %}
|
||||
<h2>Modifier mon profil</h2>
|
||||
{% if success %}
|
||||
<p class="success">Votre profil a été mis à jour avec succès !</p>
|
||||
{% endif %}
|
||||
<form id="profile form-horizontal" method="post" action="{% url 'gestioncof.views.profile' %}">
|
||||
<div class="row" style="margin: 0 15%;">
|
||||
{% csrf_token %}
|
|
@ -317,15 +317,15 @@ def survey_status(request, survey_id):
|
|||
|
||||
@cof_required
|
||||
def profile(request):
|
||||
success = False
|
||||
if request.method == "POST":
|
||||
form = UserProfileForm(request.POST, instance=request.user.profile)
|
||||
if form.is_valid():
|
||||
form.save()
|
||||
success = True
|
||||
messages.success(request,
|
||||
"Votre profil a été mis à jour avec succès !")
|
||||
else:
|
||||
form = UserProfileForm(instance=request.user.profile)
|
||||
return render(request, "profile.html", {"form": form, "success": success})
|
||||
return render(request, "gestioncof/profile.html", {"form": form})
|
||||
|
||||
|
||||
def registration_set_ro_fields(user_form, profile_form):
|
||||
|
|
Loading…
Reference in a new issue