validated_data is null serializer

已查看 22 次
跳至第一个未读帖子

Huy Hớn

未读,
2017年6月27日 13:53:022017/6/27
收件人 Django REST framework

Hi all,
I'm following guide to define serializers http://www.django-rest-framework.org/tutorial/1-serialization/
I would like to modified data before saving to database, but when I check in function create() validated_data value it's returns null object.
I'm using http post.
Could you guys please help me?

Views.py


Serializers.py

Console used to check validated_data value, it's returns null object



Thanks,

Hon Trang

Arko Roy

未读,
2017年6月30日 13:21:212017/6/30
收件人 Django REST framework
Either use a model serializer or define the fields on which derialization is to be applied when the json data you post is converted into the python dictionary format.
A model serializer if used would pick up the fields from the model otherwise if you wish to have different fields then you must explicitly mention them which you commented in your code

in your case 
回复全部
回复作者
转发
0 个新帖子