Save the list of changed usernames and lost aliases

This commit is contained in:
Yohann D'ANELLO 2020-09-05 13:50:57 +02:00
parent 7479671b3f
commit 69c5c3bb36
1 changed files with 4 additions and 17 deletions

View File

@ -246,20 +246,7 @@ class Command(ImportCommand):
filename = kwargs["save"] filename = kwargs["save"]
with open(filename, 'w') as fp: with open(filename, 'w') as fp:
json.dump(MAP_IDBDE, fp, sort_keys=True, indent=2) json.dump(MAP_IDBDE, fp, sort_keys=True, indent=2)
with open(filename + ".changed-usernames", 'w') as fp:
for pk_user, old_username, new_username in CHANGED_USERNAMES: json.dump(CHANGED_USERNAMES, fp, sort_keys=True, indent=2)
user = User.objects.get(pk=pk_user) with open(filename + ".removed-aliases", 'w') as fp:
mail_text = render_to_string("scripts/unsupported_username.txt", dict( json.dump(LOST_ALIASES, fp, sort_keys=True, indent=2)
user=user,
old_username=old_username,
new_username=new_username,
))
user.email_user("Transition à la Note Kfet 2020 : pseudo non supporté", mail_text)
for pk_user, aliases_list in CHANGED_USERNAMES:
user = User.objects.get(pk=pk_user)
mail_text = render_to_string("scripts/deleted_aliases.txt", dict(
user=user,
aliases_list=aliases_list,
))
user.email_user("Transition à la Note Kfet 2020 : suppression d'alias", mail_text)