File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
mypy_django_plugin/transformers Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -33,10 +33,14 @@ def determine_proper_manager_type(ctx: FunctionContext) -> MypyType:
3333 assert isinstance (default_return_type , Instance )
3434
3535 outer_model_info = helpers .get_typechecker_api (ctx ).scope .active_class ()
36- if outer_model_info is None or not outer_model_info .has_base (fullnames .MODEL_CLASS_FULLNAME ):
36+ if (
37+ outer_model_info is None
38+ or not outer_model_info .has_base (fullnames .MODEL_CLASS_FULLNAME )
39+ or outer_model_info .self_type is None
40+ ):
3741 return default_return_type
3842
39- return helpers .reparametrize_instance (default_return_type , [Instance ( outer_model_info , []) ])
43+ return helpers .reparametrize_instance (default_return_type , [outer_model_info . self_type ])
4044
4145
4246def get_field_type_from_lookup (
Original file line number Diff line number Diff line change 581581 - path : myapp/models.py
582582 content : |
583583 from typing import ClassVar, TypeVar
584+ from typing_extensions import Self
584585 from django.db import models
585586
586587 T = TypeVar("T", bound="MyModel")
595596 pass
596597
597598 class MySubModel(MyModel):
598- objects: ClassVar[MySubManager["MySubModel" ]] = MySubManager()
599+ objects: ClassVar[MySubManager[Self ]] = MySubManager()
599600
600601 - case : subclass_manager_without_type_parameters_disallow_any_generics
601602 main : |
You can’t perform that action at this time.
0 commit comments