Django-rest-framework: aserializer.data returns ReturnDict and OrderedDict instead of dict object

I wrote a model class serializer for a model. When I check if it serializes correctly, I get the following error.

AssertionError: ReturnDict([(u'id', 1), ('apple', OrderedDict([(u'id', 1), ('data', u'this is a apple data.')])) ...

I tried converting it to dicter file aserializer.data for dict function like

dict(aserializer.data)

Then I get the following error.

AssertionError: {'status': False, 'http': OrderedDict([(u'id', 1), ...

How to get dictionary data from serializer.

+3


source to share





All Articles