mypy-django-example icon indicating copy to clipboard operation
mypy-django-example copied to clipboard

Install all and get errors

Open dzwiedziu-nkg opened this issue 5 years ago • 0 comments

Python version: 3.6.8, Linux

pip freeze output:

Django==2.2.4
django-stubs==1.0.2
mypy==0.720
mypy-extensions==0.4.1
pkg-resources==0.0.0
pytz==2019.2
sqlparse==0.3.0
typed-ast==1.4.0
typing-extensions==3.7.4

mypy --strict-optional -p polls output:

polls/models.py:8: error: Need type annotation for 'question_text'
polls/models.py:9: error: Need type annotation for 'pub_date'
polls/models.py:23: error: Need type annotation for 'question'
polls/models.py:24: error: Need type annotation for 'choice_text'
polls/models.py:25: error: Need type annotation for 'votes'
polls/views.py:45: error: "Question" has no attribute "choice_set"
polls/views.py:58: error: "Question" has no attribute "id"

I must add #type models.CharField to polls/models.py:8. Why it is necessary?

dzwiedziu-nkg avatar Aug 23 '19 09:08 dzwiedziu-nkg