Optional DateTimeField doesn't accept an empty string as a falsey value #9241
Unanswered
marksweb
asked this question in
Potential Issue
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
This must have been asked before, but I can't find it. I've got a
DateTimeField
on a model that's allowed to beblank
/null
. Now I'm adding this to a serializer to allow for data loading from CSV;An empty field in a CSV comes through as an empty string, rather than
None
, so the test data being fed into the serializer looks like this;The code this then hits (here) doesn't check for an empty string and throws;
The subclass for null values is fairly simple;
Beta Was this translation helpful? Give feedback.
All reactions