From 877d2e28d082d8e81558a7bfe2ed528c7d2928dc Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sat, 1 Aug 2020 18:06:31 +0200 Subject: [PATCH] Import note balance of BDE and special notes --- management/commands/import_account.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/management/commands/import_account.py b/management/commands/import_account.py index ccb403e..89946e6 100644 --- a/management/commands/import_account.py +++ b/management/commands/import_account.py @@ -67,6 +67,12 @@ class Command(ImportCommand): for row in cur: MAP_IDBDE_PROMOTION[row["idbde"]] = row + cur.execute("SELECT * FROM comptes WHERE idbde <= 0 ORDER BY idbde;") + for row in cur: + note = Note.objects.get(pk=MAP_IDBDE[row["idbde"]]) + note.balance = row["solde"] + note.save() + cur.execute("SELECT * FROM comptes WHERE idbde > 0 ORDER BY idbde;") pk_club = 3 pk_user = 1 @@ -114,6 +120,7 @@ class Command(ImportCommand): "last_name": row["nom"], "email": row["mail"], "is_active": True, # temporary + "date_joined": make_aware(MAP_IDBDE_PROMOTION[row["idbde"]]["created_at"]), } profile_dict = { "pk": pk_profile,