5👍
✅
You could use django-mptt package for the project. It would compose your HR part as a tree structure and query subtrees in one batch without traversing the tree. Something like this should get you started(nothing near production obviously):
from mptt.models import MPTTModel, TreeForeignKey, TreeManager
class Organization(MPTTModel):
name = models.CharField(max_length=255, unique=True)
members = models.ManyToManyField(User)
parent = TreeForeignKey('self', related_name='children')
objects = TreeManager()
Source:stackexchange.com