Text below is from Django docs which provide
To create a recursive
relationship – an object that has a many-to-one relationship with itself – use models.ForeignKey(’self’).
If you need to create a relationship on a model that has not yet been defined, you can use the name of the model,
rather than the model object itself.
can someone give me an example of the usage of these capabilities in Django?
Thanks
You can use it to create links to other objects of this Model.
For example if you have many members in a website and each has an inviter (also of Member type) you can do the following:
If you want the inviter, you do:
If you want all members that this member has invited you use: