summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--django/contrib/auth/backends.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
index 82432e5730..bba883ba78 100644
--- a/django/contrib/auth/backends.py
+++ b/django/contrib/auth/backends.py
@@ -68,7 +68,10 @@ class ModelBackend(object):
"""
Returns True if user_obj has any permissions in the given app_label.
"""
- return bool(len([p for p in self.get_all_permissions(user_obj) if p[:p.index('.')] == app_label]))
+ for perm in self.get_all_permissions(user_obj):
+ if perm[:perm.index('.')] == app_label:
+ return True
+ return False
def get_user(self, user_id):
try: