On Jul 16, 3:36 pm, "Lic. José M. Rodriguez Bacallao"
<[EMAIL PROTECTED]> wrote:
> How can I make a recursive one-to-many relation?
>
> --
> Lic. José M. Rodriguez Bacallao

According to
http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships

``To create a recursive relationship - an object that has a many-to-
one relationship with itself - use models.ForeignKey('self').''

So basically, just take the one-to-many relationship you wanted, and
*reverse* the roles.
For example, if you had a Person object and you wanted to keep track
of the multiple Person objects who were its "employees", simply
reverse the roles.  Make each Person object keep track of its "boss"
instead.


(Hopefully that's what you were looking for; if I misunderstood the
question and you were looking for more "advanced" info, I probably
won't be much help since I'm a novice myself)


--~--~---------~--~----~------------~-------~--~----~
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