kiddouk / redisco

A Python Library for Simple Models and Containers Persisted in Redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

kishorpawar opened this issue · comments

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.