ManyToOneRel is an internal implementation class; it is not used in your models.
But why do you think you need it? As explained in detail in the documentation, when you define a ForeignKey, you automatically get the opposite relation. So, in your case, if you define parent , you automatically get self.foomodel_set already: and you can make it even more explicit using the related_name parameter:
parent = models.ForeignKey('self', blank=True, null=True, related_name='children')
Please note: if you plan to do complex things with trees, you probably want to use the django-mptt library.
source share