hontrang / django

backend
0 stars 0 forks source link

embedded document is string instead of dict when get request from client #6

Closed hontrang closed 7 years ago

hontrang commented 7 years ago

work-around: manually convert string to dict, see code below embeded field: collection code: request.data['collection'] = ast.literal_eval(request.data['collection'])

hontrang commented 7 years ago

Error msg: Invalid data. Expected a dictionary, but got str

hontrang commented 7 years ago

No other solutions, it seems like current is the best, see http://www.django-rest-framework.org/api-guide/serializers/#writing-update-methods-for-nested-representations for more detail