신은섭(Shin Eun Seop)

fix website file list

...@@ -13,21 +13,14 @@ class FileList(APIView): ...@@ -13,21 +13,14 @@ class FileList(APIView):
13 List all file, or create a new snippet. 13 List all file, or create a new snippet.
14 """ 14 """
15 15
16 - def get(self, request, path='/', format=None): 16 + def get(self, request, path="/", format=None):
17 - # file = File.objects.all()
18 - # serializer = FileSerializer(file, many=True)
19 - # print(serializer.data)
20 - # return Response(serializer.data)
21 data = s3_interface.list_path(s3_interface.BUCKET, 'test1', path) 17 data = s3_interface.list_path(s3_interface.BUCKET, 'test1', path)
22 return Response(data) 18 return Response(data)
23 19
24 20
25 - def post(self, request, format=None): 21 + def post(self, request, path="/", format=None):
26 - serializer = FileSerializer(data=request.data) 22 + # TODO file upload
27 - if serializer.is_valid(): 23 + return Response({})
28 - serializer.save()
29 - return Response(serializer.data, status=status.HTTP_201_CREATED)
30 - return Response(serializer.errors, status=status.HTTP_400_BAD_REQUEST)
31 24
32 25
33 class FileDetail(APIView): 26 class FileDetail(APIView):
......
...@@ -11,5 +11,4 @@ urlpatterns = [ ...@@ -11,5 +11,4 @@ urlpatterns = [
11 # blog 11 # blog
12 url(r'^$', views.home), 12 url(r'^$', views.home),
13 url(r'^files/', views.file_list, name='file_list'), 13 url(r'^files/', views.file_list, name='file_list'),
14 - url(r'^upload/', views.upload.as_view(), name='upload')
15 ] 14 ]
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -13,11 +13,6 @@ def home(request): ...@@ -13,11 +13,6 @@ def home(request):
13 13
14 @login_required 14 @login_required
15 def file_list(request): 15 def file_list(request):
16 - files = requests.get('http://localhost:8000/restapi/files') 16 + files = requests.get('http://localhost:8000/restapi/list')
17 files = files.json() 17 files = files.json()
18 return render(request, 'website/file_list.html', files) 18 return render(request, 'website/file_list.html', files)
19 -
20 -
21 -class upload(FormView):
22 - template_name = 'website/s3direct.html'
23 - form_class = S3DirectUploadForm
...\ No newline at end of file ...\ No newline at end of file
......