We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The type stubs do not allow to_representation to be given None, even though this is valid.
to_representation
None
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]
None should be a supported value type for serializers.
python
django
mypy
django-stubs
The text was updated successfully, but these errors were encountered:
Agreed. Are you interested in opening a PR?
Sorry, something went wrong.
Yes, I created one #511
Successfully merging a pull request may close this issue.
Bug report
What's wrong
The type stubs do not allow
to_representation
to be givenNone
, even though this is valid.mypy error:
How is that should be
None
should be a supported value type for serializers.System information
python
version: 3.11.4django
version: 4.2.7mypy
version: 1.6.1django-stubs
version: 4.2.6The text was updated successfully, but these errors were encountered: