-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
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
allow DateTimeFields to accept strings as input #2656
Comments
Yup, we probably should correctly coerce string values too. |
The error was not fixed for the DateTimeField, only the DateField. I think this issue should be reopened. |
@luccascorrea Okay, happy to accept a new issue for DateTimeField here (probably best to keep them separate) |
I found an interesting "bug" with Django Rest Framework along with how Django's DateTimeField works. Given the following TestCase:
I see this error:
It seems like Django will accept a formatted string as input, however DRF tries to format the field as a datetime rather than a string, causing the above failure case. If I change
self.date = '2015-02-03 00:00:00'
toself.date = datetime.datetime.now()
, it all works as expected.The text was updated successfully, but these errors were encountered: