권주희

implement destroy item api

......@@ -58,13 +58,13 @@ class ItemViewSet(viewsets.ViewSet):
def destroy(self, request, pk):
if request.method == 'DELETE':
print(pk)
# keyword = request.GET.get('keyword', '')
# item_list = Item.objects.filter(name__icontains=keyword)
#
# data = serializers.serialize("json", item_list)
# json_data = json.loads(data)
# return Response({'message': "delete complete"}, status=status.HTTP_200_OK)
return Response(status=status.HTTP_204_NO_CONTENT)
item = Item.objects.get(item_id = pk)
if item.is_folder == True: # 폴더는 삭제 안되도록 처리
return Response({'message': 'This item is folder.'}, status=status.HTTP_200_OK)
item.is_deleted = True
# item.delete() 이거 하면 완전 삭제되어버림 is deleted True 면 휴지통에서 리스트 조회할 수 있도록!
return Response({'message': 'delete complete'},status=status.HTTP_200_OK)
return Response({'message': 'item is not existed.'}, status=status.HTTP_204_NO_CONTENT)
def get_permissions(self):
try:
......