I have to create an organization structure (tree like) in django. Currently, I am using a one to one mapping table with auth_user having parent_id but when the level of organization is more, I have to fire multiple queries on the same table to get the children of a top level node.
Also, I need to allow permissions on several views based on that. For eg. A user can have a permission to view his own entries in a particular table and the entries added by his team. For permissions, I am currently getting the list of all the user and checking if one of the user is same as the one which added that entry and checking permission for the same(in the decorator before the view). I think it would be better if I can override has_perm method to do the same.
Is there a better way to do this or a plugin which does similar thing?