Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
I think you are a little to micro what is the difference between a Person and the other entities are they all not people? On Wed, Dec 26, 2012 at 11:07 AM, Marcelo Mendes Pereira < mpmarcel...@gmail.com> wrote: > I think a i figured out a solution but i don't have a complete > understanding about

Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
I can't see from this a clear hierarchy, please describe relationships of supervisors and managers etc. make hierarchy block diagram to show how parts relate. On Wed, Dec 26, 2012 at 11:07 AM, Marcelo Mendes Pereira < mpmarcel...@gmail.com> wrote: > I think a i figured out a solution but i don't

Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
I think a i figured out a solution but i don't have a complete understanding about the problem to explain exactly what i was doing wrong, but here is my schema now class CommonInfo(models.Model): class Meta: abstract = True class User(models.Model): user = models.OneToOneField('auth.user') cla

Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
Thanks for the reply. I omitted my entire schema i should had mentioned that i have the models Seller, Supervisor (which is a seller and supervises other sellers) and Manager and the seller can be a Person and LegalEntity too that is why i didn't made Person or LegalEntity inherit from Customer

Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Gerald Klein
It seems like you have the same idea recurring twice in this model. This IMHO doesn't require multiple inheritance. I would call commoninfo customer with it's fields and inherit django user then Person and LegalEntity inherit customer (which inherits django user) and add on their specific fields an

Re: Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
The problem seems to happen because of both PersonCustomer and LegalEntityCustomer inheriting from Customer, and their primary key being a foreign key to Customer primary key, when as LegalEntityCustomer is created its primary key is set to 1 the same of PersonCustomer and that way both referen

Database records being overriden with a multi-table inheritance schema

2012-12-26 Thread Marcelo Mendes Pereira
Hi, i am trying to model the database for a project that i am developing i have the following models class CommonInfo(models.Model): #fields class Meta: abstract = True class Person(CommonInfo): #fields class LegalEntity(CommonInfo): #fields class User(models.Model): user = models.OneToOneField(