권주희

implement trash list api

...@@ -232,6 +232,7 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -232,6 +232,7 @@ class ItemViewSet(viewsets.ViewSet):
232 return Response({'message': 'delete permanently complete'}, status=status.HTTP_200_OK) 232 return Response({'message': 'delete permanently complete'}, status=status.HTTP_200_OK)
233 return Response({'message': 'item is not existed.'}, status=status.HTTP_204_NO_CONTENT) 233 return Response({'message': 'item is not existed.'}, status=status.HTTP_204_NO_CONTENT)
234 234
235 +
235 # url: items/11/move 236 # url: items/11/move
236 # 마지막 slash도 써주어야함 237 # 마지막 slash도 써주어야함
237 @action(methods=['POST'], detail=True, permission_classes=[AllowAny], url_path='move', url_name='move') 238 @action(methods=['POST'], detail=True, permission_classes=[AllowAny], url_path='move', url_name='move')
...@@ -337,6 +338,22 @@ class ItemViewSet(viewsets.ViewSet): ...@@ -337,6 +338,22 @@ class ItemViewSet(viewsets.ViewSet):
337 res['inside_file_list'] = [] 338 res['inside_file_list'] = []
338 return Response({'data': res}, status=status.HTTP_200_OK) 339 return Response({'data': res}, status=status.HTTP_200_OK)
339 340
341 + @action(methods=['GET'], detail=False, permission_classes=[AllowAny],
342 + url_path='trash', url_name='trash')
343 + def trash(self, request):
344 + if request.method == 'GET':
345 + children = Item.objects.filter(is_deleted = True)
346 + children_data = serializers.serialize("json", children)
347 + json_children = json.loads(children_data)
348 + res = {}
349 + children_list = []
350 + for i in json_children:
351 + t = i['fields']
352 + t['id'] = i['pk']
353 + children_list.append(t)
354 + res['list'] = children_list
355 + return Response({'data': res}, status=status.HTTP_200_OK)
356 +
340 # url: /upload/ 357 # url: /upload/
341 @action(methods=['POST'], detail=True, permission_classes=[AllowAny], 358 @action(methods=['POST'], detail=True, permission_classes=[AllowAny],
342 url_path='upload', url_name='upload') 359 url_path='upload', url_name='upload')
......
...@@ -88,9 +88,9 @@ DATABASES = { ...@@ -88,9 +88,9 @@ DATABASES = {
88 # } 88 # }
89 'default': { 89 'default': {
90 'ENGINE': 'django.db.backends.postgresql', 90 'ENGINE': 'django.db.backends.postgresql',
91 - 'NAME': 'khuDrive', 91 + 'NAME': 'drive',
92 - 'USER': 'root', 92 + 'USER': 'jooheekwon',
93 - 'PASSWORD': '1234', 93 + 'PASSWORD': 'victoriawngml77',
94 'HOST': 'localhost', 94 'HOST': 'localhost',
95 'PORT': '', 95 'PORT': '',
96 } 96 }
......
...@@ -36,6 +36,7 @@ urlpatterns = [ ...@@ -36,6 +36,7 @@ urlpatterns = [
36 url(r'^<int:pk>/move/$', views.ItemViewSet.move, name='move'), 36 url(r'^<int:pk>/move/$', views.ItemViewSet.move, name='move'),
37 url(r'^<int:pk>/copy/$', views.ItemViewSet.copy, name='copy'), 37 url(r'^<int:pk>/copy/$', views.ItemViewSet.copy, name='copy'),
38 url(r'^<int:pk>/children/$', views.ItemViewSet.children, name='children'), 38 url(r'^<int:pk>/children/$', views.ItemViewSet.children, name='children'),
39 + url(r'^trash/$', views.ItemViewSet.trash, name='trash'),
39 url(r'^signup/$', views.UserViewSet.signup, name='signup'), 40 url(r'^signup/$', views.UserViewSet.signup, name='signup'),
40 url(r'^login/$', views.UserViewSet.login, name='login'), 41 url(r'^login/$', views.UserViewSet.login, name='login'),
41 url(r'^upload/$', views.ItemViewSet.upload, name='upload'), 42 url(r'^upload/$', views.ItemViewSet.upload, name='upload'),
......