mirror of https://github.com/django/django.git
Used all() and a generator for PermissionsMixin.has_perms().
This commit is contained in:
parent
ba749f8f87
commit
d7e0cf04b7
|
@ -280,10 +280,7 @@ class PermissionsMixin(models.Model):
|
|||
object is passed, it checks if the user has all required perms for this
|
||||
object.
|
||||
"""
|
||||
for perm in perm_list:
|
||||
if not self.has_perm(perm, obj):
|
||||
return False
|
||||
return True
|
||||
return all(self.has_perm(perm, obj) for perm in perm_list)
|
||||
|
||||
def has_module_perms(self, app_label):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue