How to change tastypie time format
问题 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? 回答1: 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: # models.py class MyModel(models