권주희

improve the logic of children_get api

......@@ -153,7 +153,7 @@ class ItemViewSet(viewsets.ViewSet):
url_path='children', url_name='children')
def children(self, request, pk):
if request.method == 'GET':
children = Item.objects.filter(parent = pk)
children = Item.objects.filter(parent = pk, is_deleted=False)
children_data = serializers.serialize("json", children)
json_children = json.loads(children_data)
parent = Item.objects.filter(item_id=pk) #item
......@@ -169,7 +169,7 @@ class ItemViewSet(viewsets.ViewSet):
res['list'] = children_list
return Response({'data': res}, status=status.HTTP_200_OK)
if request.method == 'POST':
name = request.POST.get('name', '')
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()
......@@ -219,4 +219,4 @@ class SharedItemViewSet(viewsets.ModelViewSet):
item = ItemViewSet.as_view({
'delete': 'destroy',
})
\ No newline at end of file
})
......