-
-
Notifications
You must be signed in to change notification settings - Fork 515
Closed as not planned
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed
Description
Bug report
I have this in settings:
BANK_ENTITIES = [('a', 'A Bank'), ('b', 'B Bank'),]
and this in my model:
entity = models.CharField(max_length=20, choices=settings.BANK_ENTITIES, blank=True)
What's wrong
mypy fails with:
models.py:247: error: Argument "choices" to "CharField" has incompatible type "tuple"; expected "Optional[Iterable[Union[Tuple[Any, Any], Tuple[str, Iterable[Tuple[Any, Any]]]]]]"
If I place a reveal in settings and another in models.py I get
settingsbase.py:90: note: Revealed type is 'builtins.list[Tuple[builtins.str, builtins.str]]'
models.py:214: note: Revealed type is 'builtins.list'
How is that should be
mypy should be able to load the full type from settings, not only that it's a list
System information
- OS: Ubuntu 18.04
pythonversion: 3.6djangoversion: 2.2mypyversion: 0.761django-stubsversion: 1.4.0
noahnu, samyisok, RJPercival, BeWe11, GergelyKalmar and 1 more
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinghelp wantedExtra attention is neededExtra attention is needed