Ticket #35792: django.patch

File django.patch, 719 bytes (added by Bona Fide IT GmbH, 7 weeks ago)
  • django/contrib/auth/backends.py

    diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
    index dd3c2e527b..a1276c71b2 100644
    a b class ModelBackend(BaseBackend):  
    5959        return user_obj.user_permissions.all()
    6060
    6161    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())
    6563
    6664    def _get_permissions(self, user_obj, obj, from_name):
    6765        """
Back to Top