Same PTR behavior in multiple inheritance

21 views
Skip to first unread message

Samuel Chávez

unread,
Nov 23, 2013, 1:03:45 PM11/23/13
to django...@googlegroups.com
Hi guys, I have some issue with model multi inheritance in Django's ORM. I'm trying to create a ChildModel(ParentModelA, ParentModelB). When I create a ChildModel register, Django's ORM creates backstage both ParentModelA and ParentModelB registers. The odd thing is that both parent registers got the same id, therefore in the ChildModel register, I got two ptrs with the same int value.

I used the next algorithm to test if it is a threat to my application:
  1. Manually create a register in ParentModelB (using the next ID that ParentModelA would create for it's new register)
  2. Create a ChildModel
  3. When saving the register, Django uses the ParentModelA next ID to create the register in ParentModelA, BUT ALSO uses that same ID to create the register in ParentModelB. This means that the register that I created in the first step was overwritten.
This is really awful for me, but I don't know if this behavior could be customized.

Thanks in advance for your help
Reply all
Reply to author
Forward
0 new messages