[Answer]-Serialization of an object with foreign key into json

1👍

I found the solution.

Literally since Conversation_Deal has a foreignkey to DealStatus class. It needs to know about it during serialization.

all = list(Conversation_Deal.objects.filter(conversation_id__in=call_id)) + list(DealStatus.objects.all())
return HttpResponse(simplejson.dumps(to_json), mimetype='application/json')

Hope this helps somebody else.

👤Houman

Leave a comment