Skip to content
This repository has been archived by the owner on Jul 20, 2018. It is now read-only.

Self-reference (recursive) ManyToOne/OneToMany relationships available? #38

Open
kishorpawar opened this issue Sep 28, 2016 · 0 comments

Comments

@kishorpawar
Copy link

This is what I meant by self-reference.

class Employee(models.model):
    manager = models.ForeignKey('Employee')

This is how Django implements recursive relationships.

To create a recursive relationship – an object that has a many-to-one relationship with itself – use models.ForeignKey('self', on_delete=models.CASCADE).

Is this available to use?

any example is appreciated.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant