Model inheritance foreign key user

2010-04-03 Thread Fredrik
Hi, I want to use it like this: """ class PersistentModel(models.Model): deleted = models.BooleanField(default = False) date_created = models.DateTimeField(default=datetime.now) date_edited = models.DateTimeField(default=datetime.now) owner = models.ForeignKey(User) class Contacts

Re: Model inheritance foreign key user

2010-04-03 Thread Thierry Chich
I think that if you want make inheritance it is because you want to have others subclasses. But then, your related name will be same for all the subclasses. There is no solution with the stable version. In the dev version, it is possible to add the origin class name in the related_name. It is

Re: Model inheritance foreign key user

2010-04-03 Thread Fredrik
What I want is to "automatic" add an owner to every object.. Is there another way to accomplish the same? Fredrik On Apr 3, 10:48 pm, Thierry Chich wrote: > I think that if you want make inheritance it is because you want to   > have others subclasses. But then, your related name will be same

Re: Model inheritance foreign key user

2010-04-03 Thread Thierry Chich
Le 3 avr. 2010 à 23:37, Fredrik a écrit : What I want is to "automatic" add an owner to every object.. Is there another way to accomplish the same? I see. I have had a similar problem. I have tried a similar solution with exactly the same effect. I could have add manualy a foreignkey

Re: Model inheritance foreign key user

2010-04-04 Thread Daniel Roseman
On Apr 3, 10:37 pm, Fredrik wrote: > What I want is to "automatic" add an owner to every object.. > > Is there another way to accomplish the same? > > Fredrik > Do you need the PersistentModel field to exist in a separate table? It sounds to me as if that would be better off as an abstract model.

Re: Model inheritance foreign key user

2010-04-04 Thread Thierry Chich
You are right but it would not change his problem. If 2 or more classes inherit from a class with a foreignkey or a manytomany, there will be a conflict in the related name Le 4 avr. 2010 à 14:11, Daniel Roseman a écrit : On Apr 3, 10:37 pm, Fredrik wrote: What I want is to "automat