validated_data is null serializer

22 views
Skip to first unread message

Huy Hớn

unread,
Jun 27, 2017, 1:53:02 PM6/27/17
to 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

unread,
Jun 30, 2017, 1:21:21 PM6/30/17
to 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 
Reply all
Reply to author
Forward
0 new messages