From b1e591ce2cf813ccf7083d459610df880c1fa6ca Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Sun, 7 Feb 2021 13:16:03 +0100 Subject: [PATCH] Update --- transfert.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/transfert.py b/transfert.py index 4da0416..cbe449d 100644 --- a/transfert.py +++ b/transfert.py @@ -59,13 +59,12 @@ def create_mails(s, profile, mails, name="E-mail"): for m in parse_list(s): mails.append(Mail(profile=profile, name=name, content=m)) + # On récupère la liste des élèves à créer ldap = ClipperLDAP() -clipper_list = ldap.get_clipper_list(stdout=sys.stdout) +# Pas besoin de filtrer les users déjà existants +clipper = ldap.get_clipper_list(stdout=sys.stdout) -# On vire les élèves déjà existants -existing_users = set(User.objects.values_list("username", flat=True)) -clippers = [clipper for clipper in clipper_list if clipper.uid not in existing_users] # On récupère la liste des départements depts = { @@ -109,7 +108,9 @@ with open("old_fiches.json") as json_file: text_field=get_text_field(obj_data), ) create_phones(data["telephones"], fiches[obj_data["n_id"]], numeros) - create_phones(data["portables"], fiches[obj_data["n_id"]], numeros, name="Portable") + create_phones( + data["portables"], fiches[obj_data["n_id"]], numeros, name="Portable" + ) create_mails(data["emails"], fiches[obj_data["n_id"]], numeros) dept_m2m_to_create.append( Profile.department.through( @@ -144,4 +145,3 @@ Phone.objects.bulk_create(numeros) for m in mails: m.profile_id = m.profile.id Mail.objects.bulk_create(mails) -