From 11e8b66a5d780a2c0ca798b4f7518710fd5945ca Mon Sep 17 00:00:00 2001 From: Pierre-antoine Comby Date: Sat, 18 Apr 2020 16:02:49 +0200 Subject: [PATCH] use Note Parent Polymorphic id for consistency --- management/commands/import_nk15.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/management/commands/import_nk15.py b/management/commands/import_nk15.py index 27a11f9..69a1e49 100644 --- a/management/commands/import_nk15.py +++ b/management/commands/import_nk15.py @@ -18,8 +18,8 @@ from django.db import IntegrityError from django.contrib.auth.models import User from note.models import Note, NoteSpecial, NoteUser, NoteClub from note.models import Alias -from note.models import Transaction, TransactionTemplate,\ - TemplateCategory, RecurrentTransaction, MembershipTransaction +from note.models import TemplateCategory, TransactionTemplate,\ + Transaction, RecurrentTransaction, MembershipTransaction, SpecialTransaction from member.models import Profile, Club, Membership """ @@ -115,7 +115,7 @@ def import_comptes(cur): club.save() note.save() - MAP_IDBDE[row["idbde"]] = note.pk + MAP_IDBDE[row["idbde"]] = note.note_ptr_id @transaction.atomic def import_boutons(cur): @@ -141,7 +141,7 @@ def import_boutons(cur): except IntegrityError as e: # button with the same name is not possible in NK20. if "unique" in e.args[0]: - qs = Club.objects.filter(note__id=MAP_IDBDE[row["destinataire"]]).values('name') + qs = Club.objects.filter(note__note_ptr=MAP_IDBDE[row["destinataire"]]).values('name') note_name = qs[0]["name"] #rename button name obj_dict["name"] ="{} {}".format(obj_dict["name"],note_name)