권주희

improve the logic of children_get api

...@@ -153,7 +153,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -153,7 +153,7 @@ class ItemViewSet(viewsets.ViewSet):
153 url_path='children', url_name='children') 153 url_path='children', url_name='children')
154 def children(self, request, pk): 154 def children(self, request, pk):
155 if request.method == 'GET': 155 if request.method == 'GET':
156 - children = Item.objects.filter(parent = pk) 156 + children = Item.objects.filter(parent = pk, is_deleted=False)
157 children_data = serializers.serialize("json", children) 157 children_data = serializers.serialize("json", children)
158 json_children = json.loads(children_data) 158 json_children = json.loads(children_data)
159 parent = Item.objects.filter(item_id=pk) #item 159 parent = Item.objects.filter(item_id=pk) #item
...@@ -169,7 +169,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -169,7 +169,7 @@ class ItemViewSet(viewsets.ViewSet):
169 res['list'] = children_list 169 res['list'] = children_list
170 return Response({'data': res}, status=status.HTTP_200_OK) 170 return Response({'data': res}, status=status.HTTP_200_OK)
171 if request.method == 'POST': 171 if request.method == 'POST':
172 - name = request.POST.get('name', '') 172 + name = request.POST.get('name', '')
173 #TODO: user_id 수정해야 173 #TODO: user_id 수정해야
174 item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=1, size=0, status=True) 174 item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=1, size=0, status=True)
175 item.save() 175 item.save()
......