From 7931f50611298bc7b1422080e8a7baa5141d1c55 Mon Sep 17 00:00:00 2001 From: Ludovic Stephan Date: Mon, 3 Aug 2020 14:30:21 +0200 Subject: [PATCH] Use ldap email --- bds/autocomplete.py | 2 +- bds/views.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bds/autocomplete.py b/bds/autocomplete.py index b6575fa4..a9308cb2 100644 --- a/bds/autocomplete.py +++ b/bds/autocomplete.py @@ -47,7 +47,7 @@ class BDSOthersSearch(autocomplete.ModelSearch): class BDSLDAPSearch(autocomplete.LDAPSearch): def result_link(self, clipper): url = reverse("bds:user.create.fromclipper", args=(clipper.clipper,)) - get = {"fullname": clipper.fullname} + get = {"fullname": clipper.fullname, "mail": clipper.mail} return "{}?{}".format(url, urlencode(get)) diff --git a/bds/views.py b/bds/views.py index 2226c7fe..70bd3c38 100644 --- a/bds/views.py +++ b/bds/views.py @@ -73,7 +73,7 @@ class UserCreateView(StaffRequiredMixin, MultipleFormView): def get_user_initial(self): if "clipper" in self.kwargs: clipper = self.kwargs["clipper"] - email = "{}@clipper.ens.fr".format(clipper) + email = self.request.GET.get("mail", "{}@clipper.ens.fr".format(clipper)) fullname = self.request.GET.get("fullname", None) if fullname: