2👍
✅
You can use the reverse ForeignKey
relation on each Company
to access their respective Users
:
def list_admins(self):
return self.user_set.filter(is_admin=True)
Doc. reference: Following relationships “backward”
Source:stackexchange.com