1
0
mirror of https://github.com/django/django.git synced 2025-06-08 21:19:13 +00:00

Simplified UserManager.with_perm() by using get_backends().

This commit is contained in:
Bona Fide IT GmbH 2025-04-23 14:01:19 +02:00 committed by GitHub
parent 1bc805e23b
commit 19067fe85a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -215,9 +215,9 @@ class UserManager(BaseUserManager):
self, perm, is_active=True, include_superusers=True, backend=None, obj=None
):
if backend is None:
backends = auth._get_backends(return_tuples=True)
backends = auth.get_backends()
if len(backends) == 1:
backend, _ = backends[0]
backend = backends[0]
else:
raise ValueError(
"You have multiple authentication backends configured and "