Closed antifuchs closed 2 years ago
is the fix here just to do whatever django-stubs does?
Almost surely, and @sbdchd has been wonderful about merging my PRs in the past, so I'd say send it up!
@antifuchs it is actually typed correctly, the __new__
method is being overloaded.
If you are typing the foreignkey by yourself you may be falling into the same trap as this issue. Take a look at my comments there (specially the first reply) that might solve your issue.
Agh, that makes sense - I missed that the field is explicitly typed to be non-optional. Changing that does fix the type error (it's just a bit of a confusing type error from pyrite).
The
null
field on ForeignKey and ForeignObject should acceptbool
values (so you can setnull=True
on fields without type errors. Currently, it only acceptsLiteral[False]
, so you can turn nullability off explicitly (which is the default anyway), but not on.The django-stubs repo has the correct type signature for this property, and doesn't seem to have had the problem previously... is the fix here just to do whatever django-stubs does?