권주희

Update views.py

......@@ -133,7 +133,8 @@ class ItemViewSet(viewsets.ViewSet):
def search(self, request):
if request.method == 'GET':
keyword = request.GET.get('keyword', '')
item_list = Item.objects.filter(name__icontains = keyword)
user_id = request.GET.get('user_id', '')
item_list = Item.objects.filter(name__icontains = keyword, user_id = user_id )
data = serializers.serialize("json", item_list)
json_data = json.loads(data)
......@@ -260,8 +261,8 @@ class ItemViewSet(viewsets.ViewSet):
return Response({'data': res}, status=status.HTTP_200_OK)
if request.method == 'POST':
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)
user_id = request.GET.get('user_id', '')
item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=user_id, size=0, status=True)
item.save()
item = Item.objects.filter(item_id = item.item_id)
item_data = serializers.serialize("json", item)
......