mirror of
https://github.com/django/django.git
synced 2025-08-22 09:49:12 +00:00
Simplified UserManager.with_perm() by using get_backends().
This commit is contained in:
parent
1bc805e23b
commit
19067fe85a
@ -215,9 +215,9 @@ class UserManager(BaseUserManager):
|
|||||||
self, perm, is_active=True, include_superusers=True, backend=None, obj=None
|
self, perm, is_active=True, include_superusers=True, backend=None, obj=None
|
||||||
):
|
):
|
||||||
if backend is None:
|
if backend is None:
|
||||||
backends = auth._get_backends(return_tuples=True)
|
backends = auth.get_backends()
|
||||||
if len(backends) == 1:
|
if len(backends) == 1:
|
||||||
backend, _ = backends[0]
|
backend = backends[0]
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
"You have multiple authentication backends configured and "
|
"You have multiple authentication backends configured and "
|
||||||
|
Loading…
x
Reference in New Issue
Block a user