Showing
1 changed file
with
4 additions
and
3 deletions
... | @@ -133,7 +133,8 @@ class ItemViewSet(viewsets.ViewSet): | ... | @@ -133,7 +133,8 @@ class ItemViewSet(viewsets.ViewSet): |
133 | def search(self, request): | 133 | def search(self, request): |
134 | if request.method == 'GET': | 134 | if request.method == 'GET': |
135 | keyword = request.GET.get('keyword', '') | 135 | keyword = request.GET.get('keyword', '') |
136 | - item_list = Item.objects.filter(name__icontains = keyword) | 136 | + user_id = request.GET.get('user_id', '') |
137 | + item_list = Item.objects.filter(name__icontains = keyword, user_id = user_id ) | ||
137 | 138 | ||
138 | data = serializers.serialize("json", item_list) | 139 | data = serializers.serialize("json", item_list) |
139 | json_data = json.loads(data) | 140 | json_data = json.loads(data) |
... | @@ -260,8 +261,8 @@ class ItemViewSet(viewsets.ViewSet): | ... | @@ -260,8 +261,8 @@ class ItemViewSet(viewsets.ViewSet): |
260 | return Response({'data': res}, status=status.HTTP_200_OK) | 261 | return Response({'data': res}, status=status.HTTP_200_OK) |
261 | if request.method == 'POST': | 262 | if request.method == 'POST': |
262 | name = request.POST.get('name', '') | 263 | name = request.POST.get('name', '') |
263 | - #TODO: user_id 수정해야 | 264 | + user_id = request.GET.get('user_id', '') |
264 | - item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=1, size=0, status=True) | 265 | + item = Item(is_folder=True, name=name, file_type="folder", path="", parent=pk, user_id=user_id, size=0, status=True) |
265 | item.save() | 266 | item.save() |
266 | item = Item.objects.filter(item_id = item.item_id) | 267 | item = Item.objects.filter(item_id = item.item_id) |
267 | item_data = serializers.serialize("json", item) | 268 | item_data = serializers.serialize("json", item) | ... | ... |
-
Please register or login to post a comment