Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
C_Team_KhuDrive
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
권주희
2020-06-11 00:31:22 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4480152e276a26f06f740b935643abf948091ee8
4480152e
1 parent
17ecff4d
implement children post api
- folder 생성 api
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
backend/api/views.py
backend/api/views.py
View file @
4480152
...
...
@@ -169,14 +169,18 @@ class ItemViewSet(viewsets.ViewSet):
res
[
'list'
]
=
children_list
return
Response
({
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
if
request
.
method
==
'POST'
:
print
(
"post"
)
#
# data = JSONParser().parse(request)
# serializer = ItemSerializer(data=data)
# if serializer.is_valid():
# serializer.save()
# return Response(serializer.data)
return
Response
({
'message'
:
'post is not existed.'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
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
)
item
.
save
()
item
=
Item
.
objects
.
filter
(
item_id
=
item
.
item_id
)
item_data
=
serializers
.
serialize
(
"json"
,
item
)
json_item
=
json
.
loads
(
item_data
)
res
=
json_item
[
0
][
'fields'
]
res
[
'id'
]
=
json_item
[
0
][
'pk'
]
res
[
'inside_folder_list'
]
=
[]
res
[
'inside_file_list'
]
=
[]
return
Response
({
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
class
SharedItemViewSet
(
viewsets
.
ModelViewSet
):
...
...
Please
register
or
login
to post a comment