From 20fd738c856dfa21a0d2d251b92459d6641c782c Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Wed, 20 Mar 2013 13:05:59 +0000 Subject: [PATCH] iso formated datetime aware fields with +0000 offset should use 'Z' suffix instead --- rest_framework/fields.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rest_framework/fields.py b/rest_framework/fields.py index 4b6931ad4..a0f52f506 100644 --- a/rest_framework/fields.py +++ b/rest_framework/fields.py @@ -609,7 +609,10 @@ class DateTimeField(WritableField): return None if self.format.lower() == ISO_8601: - return value.isoformat() + ret = value.isoformat() + if ret.endswith('+00:00'): + ret = ret[:-6] + 'Z' + return ret return value.strftime(self.format)