1👍
✅
You MAY add a related_name
to you FK to User
:
class PlayerPermissionGroupMember(models.Model):
permission_group = models.ForeignKey(PlayerPermissionGroup)
user = models.ForeignKey(User, related_name='player_permision_groups')
Then you can do:
getMembers(group):
return User.objects.filter(player_permision_groups__permission_group=group)
You may omit the related_name
but the lookup changes slightly by using the default related_name
that django assigns instead.
Source:stackexchange.com