summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Marillonnet <pmarillonnet@entrouvert.com>2017-11-10 09:37:15 (GMT)
committerPaul Marillonnet <pmarillonnet@entrouvert.com>2017-11-10 09:37:15 (GMT)
commitebd9abf0bb2ebc17cab45f6bcbbe3189f1092e75 (patch)
treebe9637a3dfd72448d0fbaf2360088496c2101a2a
parentce46ba96f9e3513aa07c31ab4fe1dcce87a96b6d (diff)
downloadpaul-synchro-ebd9abf0bb2ebc17cab45f6bcbbe3189f1092e75.zip
paul-synchro-ebd9abf0bb2ebc17cab45f6bcbbe3189f1092e75.tar.gz
paul-synchro-ebd9abf0bb2ebc17cab45f6bcbbe3189f1092e75.tar.bz2
POC Campus Condorcet : delimiteurs pour les listes d'email
-rw-r--r--django/sp_sso/invite/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/sp_sso/invite/views.py b/django/sp_sso/invite/views.py
index 0098b86..bb19d26 100644
--- a/django/sp_sso/invite/views.py
+++ b/django/sp_sso/invite/views.py
@@ -32,6 +32,7 @@ class InvitationFormView(FormView):
form_class = InvitationForm
template_name = 'invite/invitation_form.html'
success_url = '/invite/sent'
+ allowed_email_delimiters=[';', ',', ' ']
def get_initial(self):
initial = super(InvitationFormView, self).get_initial()
@@ -67,7 +68,9 @@ class InvitationFormView(FormView):
multiple_email_invitation = {}
# Send as many invites as there are email adresses (blank-separated)
- for email in invitation['email'].split(' '):
+ for delimiter in self.allowed_email_delimiters:
+ invitation['email'] = invitation['email'].replace(delimiter, ' ')
+ for email in invitation['email'].split():
multiple_email_invitation = invitation.copy()
multiple_email_invitation['email'] = email
do_invite(multiple_email_invitation)