diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
index dd3c2e527b..a1276c71b2 100644
a
|
b
|
class ModelBackend(BaseBackend):
|
59 | 59 | return user_obj.user_permissions.all() |
60 | 60 | |
61 | 61 | def _get_group_permissions(self, user_obj): |
62 | | user_groups_field = get_user_model()._meta.get_field("groups") |
63 | | user_groups_query = "group__%s" % user_groups_field.related_query_name() |
64 | | return Permission.objects.filter(**{user_groups_query: user_obj}) |
| 62 | return Permission.objects.filter(group__in=user_obj.groups.all()) |
65 | 63 | |
66 | 64 | def _get_permissions(self, user_obj, obj, from_name): |
67 | 65 | """ |