from django.forms.models import model_to_dict def obj_to_dict(obj_list): result = [] for obj in obj_list: result.append(model_to_dict(obj)) return result return HttpResponse(json.dumps(obj_to_dict(result)), content_type='application/json')
from django.forms.models import model_to_dict
def obj_to_dict(obj_list):
result = []
for obj in obj_list:
result.append(model_to_dict(obj))
return result
return HttpResponse(json.dumps(obj_to_dict(result)), content_type='application/json')