Skip to content

Model Field in type annotation runtime error #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cs-cordero opened this issue Apr 1, 2019 · 3 comments
Closed

Model Field in type annotation runtime error #61

cs-cordero opened this issue Apr 1, 2019 · 3 comments

Comments

@cs-cordero
Copy link
Contributor

Originally posted on the gitter:

I'm coming across this issue where I'm trying to use a Field in a type annotation something like: Dict[Field, Any]

If i use mypy on this with django-stubs enabled, i get this error message:

`Missing type parameters for generic type`

so then i change it to Dict[Field[Any, Any], Any], and that fixes the problem in mypy, but at runtime, it fails:

`TypeError: 'type' object is not subscriptable`
@mkurnikov
Copy link
Member

Could you confirm whether errors goes away when you specify disallow_any_generics=False in the config file?

Currently django-stubs is incompatible with this setting, I've created issue for that https://github.com/mkurnikov/django-stubs/issues/64.

@cs-cordero
Copy link
Contributor Author

Yes, it seems the errors do go away when you specify that setting in the config file.

@mkurnikov
Copy link
Member

Closing in favor of #64

@TonyRippy TonyRippy mentioned this issue Dec 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants