I am trying to use DRF serializers to serialize a model object. I believe that the DatetimeField in the object will not output "2015-10-21T09:28:53.769000Z" the ISO-8601 format
I am looking for a DRF document, why I can not output the ISO-8601 format. According to datetimefield says:
format - A string representing the output format. If not specified, this default value matches the value of the DATETIME_FORMAT parameter, which will be "iso-8601" if not set. Setting to a format string indicates that the return values ββof to_representation should be forced into the string output. Format strings are described below. Setting this value to None means Python
Does this mean that it defaults to the iso-8601 if I never set the DATETIME_FORMAT argument? There are no changes yet.
When I try to write the django project setup as follows:
REST_FRAMEWORK = { 'DATETIME_FORMAT': "iso-8601", }
or I write in the DatetimeField argument as follows:
class UserSerializer(...): last_login = DatetimeField(format='iso-8601') class Meta: model = User fields = ('email', 'displayname', 'is_active', 'date_joined', 'last_login')
This has not changed yet.
Does anyone know how to install it?
source share