Bug report
The validation of allowed filters seem to be incorrect for the _id variant of Fk/OneToOne fields
What's wrong
class MyModel(models.Model):
prospect = models.OneToOneField(
"foo.OtherModel"
blank=True,
null=True,
on_delete=models.CASCADE,
)
MyModel.objects.filter(prospect=None) # OK
MyModel.objects.filter(prospect_id=None) # error: Incompatible type for lookup 'prospect_id': (got "None", expected "str | int") [misc]
How is that should be
MyModel.objects.filter(prospect=None) # OK
MyModel.objects.filter(prospect_id=None) # OK
System information
- OS: ubuntu 24.04
- python version: 3.11
- django version: 5.2.15
- mypy version: 2.1.0
- django-stubs version: 6.0.6
- django-stubs-ext version: 6.0.6
Bug report
The validation of allowed filters seem to be incorrect for the
_idvariant of Fk/OneToOne fieldsWhat's wrong
How is that should be
System information