How to get all users of a group in Django?
The following query solved my problem.
User.objects.filter(groups__name='Staff')
Thanks to @SardorbekImomaliev for figuring it out.
This query allows you to find users by group id rather than by group name:
group = Group.objects.get(id=group_id)
users = group.user_set.all()
Here's a query that lets you search by group name:
users = User.objects.filter(groups_name='group_name')