신은섭(Shin Eun Seop)

fix website file list

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