POC Campus Condorcet : nettoyage du code des vues

This commit is contained in:
Paul Marillonnet 2017-09-25 15:34:02 +02:00
parent b13c0aa2c1
commit a01336c9d8
1 changed files with 10 additions and 7 deletions

View File

@ -1,6 +1,6 @@
import logging
from django.views.generic import FormView
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ugettext_lazy as _, ugettext as ugt
from .forms import RegistrationForm
from .utils import ldap_contains_user, wcs_submit, sso_attributes, \
@ -42,14 +42,17 @@ class RegistrationFormView(FormView):
if self.request.session.get('tracking_code'):
initial.update(initial_from_tracking_code(
self.request.session['tracking_code']))
message = initial['message'] if initial.get('message') else ''
initial['user_help_msg'] = \
initial.get('hote_prenom')+' '+initial.get('hote_nom')\
+_(
' sent an invite with the following invitation message:\n"'
) + initial['message'] + '"\n' + _(
"""Please check the entries below, fill in the empty fields
and submit your account request.\n""")
_("""%s %s sent an invite with the following invitation
message:\n
"%s"\n
Please check the entries below, fill in the empty fields
and submit your account request.\n""") % (
initial.get('hote_prenom'),
initial.get('hote_nom'),
message)
else:
initial['user_help_msg'] = _("Please fill in the empty fields and "
"submit your account request")