You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
which is technically valid in Django, running mypy on this file with django-stubs installed produces the following error:
$ mypy myapp/models.py --cache-dir /dev/nullmyapp/models.py:7: error: Unexpected keyword argument "null" for "ManyToManyField" [call-arg]/home/user/workspace/django-example/venv/lib/python3.12/site-packages/django-stubs/db/models/fields/related.pyi:256: note: "ManyToManyField" defined here
It is passed as a kwarg from ManyToManyField's constructor to RelatedField's constructor, from where it is (still) passed as a kwarg to Field's constructor, where it is defined as an argument to the function (link to relevant stub)
How is that should be
The type stubs in ManyToManyField should probably reflect all arguments that can be passed as kwargs all the way down to Field's constructor.
System information
OS: Linux x86_64
python version: 3.12.4
django version: 5.1.6
mypy version: 1.15.0
django-stubs version: 5.1.3
django-stubs-ext version: 5.1.3
The text was updated successfully, but these errors were encountered:
Bug report
What's wrong
When defining a model like this:
which is technically valid in Django, running
mypy
on this file withdjango-stubs
installed produces the following error:It is passed as a kwarg from
ManyToManyField
's constructor toRelatedField
's constructor, from where it is (still) passed as a kwarg toField
's constructor, where it is defined as an argument to the function (link to relevant stub)How is that should be
The type stubs in
ManyToManyField
should probably reflect all arguments that can be passed as kwargs all the way down toField
's constructor.System information
python
version: 3.12.4django
version: 5.1.6mypy
version: 1.15.0django-stubs
version: 5.1.3django-stubs-ext
version: 5.1.3The text was updated successfully, but these errors were encountered: