From 9b6c3b34ef085581985a8d4098c3600f035d08ab Mon Sep 17 00:00:00 2001 From: Tony Narlock Date: Fri, 3 May 2024 17:02:37 -0500 Subject: [PATCH] BaseBackend.get_user: Relax `user_id` param type (#2121) In theory, this pk could be anything, given that `AUTH_USER_MODEL` can resolved to any custom model (often a `AbstractBaseUser` subclass.) See also: - https://docs.djangoproject.com/en/5.0/topics/auth/customizing/#substituting-a-custom-user-model - https://github.com/django/django/blob/5.0.4/django/contrib/auth/backends.py --- django-stubs/contrib/auth/backends.pyi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django-stubs/contrib/auth/backends.pyi b/django-stubs/contrib/auth/backends.pyi index d4f3aeb67..87d0bf825 100644 --- a/django-stubs/contrib/auth/backends.pyi +++ b/django-stubs/contrib/auth/backends.pyi @@ -13,7 +13,7 @@ UserModel: Any class BaseBackend: def authenticate(self, request: HttpRequest | None, **kwargs: Any) -> AbstractBaseUser | None: ... - def get_user(self, user_id: int) -> AbstractBaseUser | None: ... + def get_user(self, user_id: Any) -> AbstractBaseUser | None: ... def get_user_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ... def get_group_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ... def get_all_permissions(self, user_obj: _AnyUser, obj: Model | None = ...) -> set[str]: ...