File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed
django-stubs/contrib/auth
tests/assert_type/contrib/auth Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -24,8 +24,8 @@ _AnyUser: TypeAlias = _User | AnonymousUser
24
24
# These are only needed for generic classes in order to bind to a specific implementation
25
25
_AnyUserType = TypeVar ("_AnyUserType" , bound = _AnyUser ) # noqa: PYI018
26
26
27
- # do not use the alias `_User` so the bound remains at `AbstractUser `
28
- _UserType = TypeVar ("_UserType" , bound = AbstractUser )
27
+ # do not use the alias `_User` so the bound remains at `AbstractBaseUser `
28
+ _UserType = TypeVar ("_UserType" , bound = AbstractBaseUser )
29
29
30
30
def update_last_login (sender : _UserModel , user : _User , ** kwargs : Any ) -> None : ...
31
31
Original file line number Diff line number Diff line change
1
+ from django .contrib .auth .models import AbstractBaseUser , UserManager
2
+ from typing_extensions import assert_type
3
+
4
+
5
+ class MyUser (AbstractBaseUser ):
6
+ pass
7
+
8
+
9
+ class Manager (UserManager [MyUser ]):
10
+ pass
11
+
12
+
13
+ assert_type (Manager ().create_user ("username" ), MyUser )
You can’t perform that action at this time.
0 commit comments