권주희

fix the response object

......@@ -45,7 +45,12 @@ class ItemViewSet(viewsets.ViewSet):
data = serializers.serialize("json", item_list)
json_data = json.loads(data)
return Response({'data': {'list' : json_data}}, status=status.HTTP_200_OK)
res = []
for i in json_data:
t = i['fields']
t['id'] = i['pk']
res.append(t)
return Response({'data': {'list' : res}}, status=status.HTTP_200_OK)
# url: items/11/
# 마지막 slash도 써주어야함
......@@ -136,7 +141,10 @@ class SharedItemViewSet(viewsets.ModelViewSet):
item_json = serializers.serialize("json", item)
json_data = json.loads(item_json)
return Response({"shared": sharedfile.created_time , 'data': json_data}, status=status.HTTP_200_OK)
print(json_data)
res = json_data[0]['fields']
res['id'] = json_data[0]['pk']
return Response({"shared": sharedfile.created_time , 'data': res}, status=status.HTTP_200_OK)
item = ItemViewSet.as_view({
'delete': 'destroy',
......