Open
Description
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.
Metadata
Metadata
Assignees
Labels
No labels