Is there anyway to accept timestamp as an input for DateField and DateTimeField fields by configuring DATETIME_INPUT_FORMATS?
I can convert all my outputs to timestamp using :
REST_FRAMEWORK = [
"DATETIME_FORMAT": "%s"
]
But it seems having %s for inputs does not work:
REST_FRAMEWORK = [
"DATETIME_FORMAT": "%s",
"DATETIME_INPUT_FORMATS": ["%s"],
]
It raises this validation error:
{
"my_field_name": [
"Date has wrong format. Use one of these formats instead: %s."
]
}
UPDATE
I can create a custom DateTimeField or DateField field. But it's really cumbersome as I have to change many fields all over the project. not to mention may of these fields are auto generated by ModelSerializer and I don't really like to overwrite them manually.