Update
This commit is contained in:
parent
54e6877998
commit
b1e591ce2c
1 changed files with 6 additions and 6 deletions
12
transfert.py
12
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue