mirror of
https://gitlab.crans.org/bde/nk20-scripts
synced 2024-12-27 01:42:24 +00:00
use Note Parent Polymorphic id for consistency
This commit is contained in:
parent
fa0ac58999
commit
11e8b66a5d
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user