Open
Description
Bug report
What's wrong
The type stubs do not allow to_representation
to be given None
, even though this is valid.
from rest_framework import serializers
serializers.DateField(allow_null=True).to_representation(None)
mypy error:
Argument 1 to "to_representation" of "Field" has incompatible type "None"; expected "date" [arg-type]
How is that should be
None
should be a supported value type for serializers.
System information
- OS: PopOS 22.04
python
version: 3.11.4django
version: 4.2.7mypy
version: 1.6.1django-stubs
version: 4.2.6