권주희

implement children post api

- folder 생성 api
......@@ -169,14 +169,18 @@ class ItemViewSet(viewsets.ViewSet):
res['list'] = children_list
return Response({'data': res}, status=status.HTTP_200_OK)
if request.method == 'POST':
print("post")
#
# data = JSONParser().parse(request)
# serializer = ItemSerializer(data=data)
# if serializer.is_valid():
# serializer.save()
# return Response(serializer.data)
return Response({'message': 'post is not existed.'}, status=status.HTTP_204_NO_CONTENT)
name = request.POST.get('name', '')
#TODO: user_id 수정해야
item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=1, size=0, status=True)
item.save()
item = Item.objects.filter(item_id = item.item_id)
item_data = serializers.serialize("json", item)
json_item = json.loads(item_data)
res = json_item[0]['fields']
res['id']=json_item[0]['pk']
res['inside_folder_list'] = []
res['inside_file_list'] = []
return Response({'data': res}, status=status.HTTP_200_OK)
class SharedItemViewSet(viewsets.ModelViewSet):
......