I needed a very similar thing and I ultimately decided to use a "type" char
field in the base model that would contain the model name of the subtype.

Michael

> -----Original Message-----
> From: django-users@googlegroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of Ernesto Rodriguez Reina
> Sent: Friday, August 24, 2007 7:38 PM
> To: Django users
> Subject: modeling db inheritance
> 
> 
> Hello,
> I'm need to model a table inheritance in a new project i'm working on, but
> i
> don't know the best way to do it.
> 
> Here is an explample of what i need:
> 
> class User(models.Model):
>       firstname  = models.CharField(maxlength=100)
>       lastname  = models.CharField(maxlength=100)
> 
> # This should inherit User
> class Student(models.Model):
>       school    = models.ForeignKey(School)
> 
> # This should inherit User
> class Teacher(models.Model):
>       school    = models.ForeignKey(School)
>       students  = models.ManyToMany(Students)
> 
> # This should inherit User
> class Manager(models.Model):
>       pass
> 
> I think it could be adding a ForeingKey to User, but, how to know, having
> a
> User if it is Student, Teacher or Manager?
> 
> Any ideas?
> 
> Best Reagards,
> 
> --
> Lic. Ernesto Rodríguez Reina
> Facultad de Matemática y Computación, UH.
> http://profesores.matcom.uh.cu/~erreina/
> 
> 

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to