Showing
1 changed file
with
10 additions
and
2 deletions
... | @@ -45,7 +45,12 @@ class ItemViewSet(viewsets.ViewSet): | ... | @@ -45,7 +45,12 @@ class ItemViewSet(viewsets.ViewSet): |
45 | 45 | ||
46 | data = serializers.serialize("json", item_list) | 46 | data = serializers.serialize("json", item_list) |
47 | json_data = json.loads(data) | 47 | json_data = json.loads(data) |
48 | - return Response({'data': {'list' : json_data}}, status=status.HTTP_200_OK) | 48 | + res = [] |
49 | + for i in json_data: | ||
50 | + t = i['fields'] | ||
51 | + t['id'] = i['pk'] | ||
52 | + res.append(t) | ||
53 | + return Response({'data': {'list' : res}}, status=status.HTTP_200_OK) | ||
49 | 54 | ||
50 | # url: items/11/ | 55 | # url: items/11/ |
51 | # 마지막 slash도 써주어야함 | 56 | # 마지막 slash도 써주어야함 |
... | @@ -136,7 +141,10 @@ class SharedItemViewSet(viewsets.ModelViewSet): | ... | @@ -136,7 +141,10 @@ class SharedItemViewSet(viewsets.ModelViewSet): |
136 | item_json = serializers.serialize("json", item) | 141 | item_json = serializers.serialize("json", item) |
137 | 142 | ||
138 | json_data = json.loads(item_json) | 143 | json_data = json.loads(item_json) |
139 | - return Response({"shared": sharedfile.created_time , 'data': json_data}, status=status.HTTP_200_OK) | 144 | + print(json_data) |
145 | + res = json_data[0]['fields'] | ||
146 | + res['id'] = json_data[0]['pk'] | ||
147 | + return Response({"shared": sharedfile.created_time , 'data': res}, status=status.HTTP_200_OK) | ||
140 | 148 | ||
141 | item = ItemViewSet.as_view({ | 149 | item = ItemViewSet.as_view({ |
142 | 'delete': 'destroy', | 150 | 'delete': 'destroy', | ... | ... |
-
Please register or login to post a comment