Registration: remove success var, fix message

`member.profile` was not up-to-date where we used to send the success
message => move it to the place where the success var is set tu `True`
and remove the success var was which becomes irrelevant.
This commit is contained in:
Martin Pépin 2017-05-23 05:41:57 +01:00
parent dba8a0a857
commit f0f1585661

View file

@ -402,7 +402,6 @@ def registration(request):
request_dict = request.POST.copy()
member = None
login_clipper = None
success = False
# -----
# Remplissage des formulaires
@ -492,16 +491,18 @@ def registration(request):
for club in clubs_form.cleaned_data['clubs']:
club.membres.add(member)
club.save()
success = True
# Messages
if success:
msg = ("L'inscription de {:s} (<tt>{:s}</tt>) a été "
"enregistrée avec succès."
.format(member.get_full_name(), member.email))
if member.profile.is_cof:
msg += "\nIl est désormais membre du COF n°{:d} !".format(
member.profile.id)
messages.success(request, msg, extra_tags='safe')
# ---
# Success
# ---
msg = ("L'inscription de {:s} (<tt>{:s}</tt>) a été "
"enregistrée avec succès."
.format(member.get_full_name(), member.email))
if profile.is_cof:
msg += "\nIl est désormais membre du COF n°{:d} !".format(
member.profile.id)
messages.success(request, msg, extra_tags='safe')
return render(request, "gestioncof/registration_post.html",
{"user_form": user_form,
"profile_form": profile_form,