-
-
Notifications
You must be signed in to change notification settings - Fork 485
TemplateView and AuthenticatedHttpRequest producing Liskov substitution error #1024
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
Comments
Are you sure that this is a bug? Looks more like a feature request for me. Currently there is no way to say mypy "this class decorator allows LSP violation, when HttpRequest is replaced by some user-defined AuthenticatedHttpRequest (with this name? Or how should we determine it?)". The stubs are saying basically "
1-line assert is not worth complexity required to support this automatically, IMO. Please share your suggestions on other ways to handle this, if you have any ideas - PR or clean explanation is welcome! |
I believe @sshishov is referring to the suggestion in the README (the same reason I am here). Please consider mentioning the |
@sterliakov yes I was referencing exactly the example from README. As it looks very clear as a solution and we tried to apply it everywhere. Could you please mention in README that the provided case will work only for |
@sterliakov thank you very much! You helped me. |
Thanks @sterliakov , we have started using mentioned |
Bug report
Trying to apply the suggestion, how to assign authenticated user to the request:
What's wrong
MyPy returns the following error:
How is that should be
No errors should be reported
System information
python
version: 3.9.12django
version: 3.2.13mypy
version: 0.950django-stubs
version: 1.12.0django-stubs-ext
version: 0.5.0The text was updated successfully, but these errors were encountered: