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
2424# These are only needed for generic classes in order to bind to a specific implementation
2525_AnyUserType = TypeVar ("_AnyUserType" , bound = _AnyUser ) # noqa: PYI018
2626
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 )
2929
3030def update_last_login (sender : _UserModel , user : _User , ** kwargs : Any ) -> None : ...
3131
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