mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-16 19:41:06 +03:00
Update to serialization results (closes #3881).
This commit is contained in:
parent
72372efdb6
commit
d738ad7ae6
|
@ -43,7 +43,7 @@ We can now use `CommentSerializer` to serialize a comment, or list of comments.
|
|||
|
||||
serializer = CommentSerializer(comment)
|
||||
serializer.data
|
||||
# {'email': u'leila@example.com', 'content': u'foo bar', 'created': datetime.datetime(2012, 8, 22, 16, 20, 9, 822774)}
|
||||
# {'email': 'leila@example.com', 'content': 'foo bar', 'created': '2016-01-27T15:17:10.375877'}
|
||||
|
||||
At this point we've translated the model instance into Python native datatypes. To finalise the serialization process we render the data into `json`.
|
||||
|
||||
|
@ -51,7 +51,7 @@ At this point we've translated the model instance into Python native datatypes.
|
|||
|
||||
json = JSONRenderer().render(serializer.data)
|
||||
json
|
||||
# '{"email": "leila@example.com", "content": "foo bar", "created": "2012-08-22T16:20:09.822"}'
|
||||
# b'{"email":"leila@example.com","content":"foo bar","created":"2016-01-27T15:17:10.375877"}'
|
||||
|
||||
## Deserializing objects
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user