Used all() and a generator for PermissionsMixin.has_perms().

This commit is contained in:
Curtis Maloney 2016-08-13 22:46:51 +10:00 committed by Tim Graham
parent ba749f8f87
commit d7e0cf04b7
1 changed files with 1 additions and 4 deletions
django/contrib/auth

View File

@ -280,10 +280,7 @@ class PermissionsMixin(models.Model):
object is passed, it checks if the user has all required perms for this object is passed, it checks if the user has all required perms for this
object. object.
""" """
for perm in perm_list: return all(self.has_perm(perm, obj) for perm in perm_list)
if not self.has_perm(perm, obj):
return False
return True
def has_module_perms(self, app_label): def has_module_perms(self, app_label):
""" """