Skip to content
Snippets Groups Projects
Commit 11e8b66a authored by Pierre-antoine Comby's avatar Pierre-antoine Comby
Browse files

use Note Parent Polymorphic id for consistency

parent fa0ac589
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment