You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
This is what I meant by self-reference.
This is how Django implements recursive relationships.
Is this available to use?
any example is appreciated.
The text was updated successfully, but these errors were encountered: