proper use of messages in registration
This commit is contained in:
parent
b7ecac3db6
commit
51c0e2dabc
2 changed files with 12 additions and 8 deletions
|
@ -2,10 +2,6 @@
|
|||
|
||||
{% block realcontent %}
|
||||
<h2>Inscription d'un nouveau membre</h2>
|
||||
{% if success %}
|
||||
<p class="success">L'inscription de {{ member.first_name }} {{ member.last_name }} (<tt>{{ member.username }}</tt>) a été enregistrée avec succès.
|
||||
{% if member.profile.is_cof %}Il est désormais membre du COF n°{{ member.profile.num }} !{% endif %}</p>
|
||||
{% endif %}
|
||||
<div id="form-placeholder">
|
||||
{% include "registration_form.html" %}
|
||||
</div>
|
||||
|
|
|
@ -388,7 +388,7 @@ def registration_form2(request, login_clipper=None, username=None):
|
|||
profile_form = RegistrationProfileForm()
|
||||
event_formset = EventFormset(events=events, prefix='events')
|
||||
clubs_form = ClubsForm()
|
||||
return render(request, "registration_form.html",
|
||||
return render(request, "gestioncof/registration_form.html",
|
||||
{"member": member, "login_clipper": login_clipper,
|
||||
"user_form": user_form,
|
||||
"profile_form": profile_form,
|
||||
|
@ -491,9 +491,17 @@ def registration(request):
|
|||
club.membres.add(member)
|
||||
club.save()
|
||||
success = True
|
||||
return render(request, "registration_post.html",
|
||||
{"success": success,
|
||||
"user_form": user_form,
|
||||
# Messages
|
||||
if success:
|
||||
msg = ("L'inscription de {:s} (<tt>{:s}</tt>) a été "
|
||||
"enregistrées avec succès"
|
||||
.format(member.get_full_name(), member.email))
|
||||
if member.profile.is_cof:
|
||||
msg += "Il est désormais membre du COF n°{:d} !".format(
|
||||
member.profile.num)
|
||||
messages.success(request, msg, extra_tags='safe')
|
||||
return render(request, "gestioncof/registration_post.html",
|
||||
{"user_form": user_form,
|
||||
"profile_form": profile_form,
|
||||
"member": member,
|
||||
"login_clipper": login_clipper,
|
||||
|
|
Loading…
Reference in a new issue