Hi all,
Using TG 1.9.7a4 and have a case where I have two foreign keys that
point to the same table. In one transaction (page submittal) I would
like to add records for the two foreign keys . When I only had one
foreign key to populate Diez Roggisch helped me out by telling me that
I had to do a DBSession.add(project) followed by a DBSession.flush()
to get an ID for the newly added record so I could update the foreign
key reference. Now I would like to add two records during the
transaction but it doesn't appear that I can repeat the add and flush:
person.fullname = kw['assigned_by_name']
DBSession.add(person)
DBSession.flush()
ai.assigned_by_id = person.id
log.debug(person.id)
log.debug(person.fullname)
person.fullname = kw['assigned_to_name']
DBSession.add(person)
DBSession.flush()
ai.assigned_to_id = person.id
log.debug(person.id)
log.debug(person.fullname)
DBSession.add(ai)
My log file shows:
2
Name by
2
Name to
and "Name to" was what is stored in the table (with an ID of 2). I
need both "Name by" and "Name to" stored in the person table.
Can I do what I'm trying to do?
Thanks,
Eric
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TurboGears" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---