I’m writing an API server using Django 1.4.2 and Tastypie 0.9.11.
For all the datetime output, I’m using the default iso 8601 format, for example: “2012-11-20T02:48:19+00:00”. But I want to get a “2012-11-20T02:48:19Z” format. How to do it easily without customizing each datetime field?
Formatting a date is probably best done in the templates. However, Tastypie allows you to add or modify fields returned by the API using the dehydrate cycle. For example:
Now, if you make the HTTP request, you should see a new line for “new_date_format”.