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 13:45:28 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
928be0be1513241d32c94cb6cb94b173db7f8904
928be0be
1 parent
6bfcd36e
improve the logic of children_get api
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
backend/api/views.py
backend/api/views.py
View file @
928be0b
...
...
@@ -153,7 +153,7 @@ class ItemViewSet(viewsets.ViewSet):
url_path
=
'children'
,
url_name
=
'children'
)
def
children
(
self
,
request
,
pk
):
if
request
.
method
==
'GET'
:
children
=
Item
.
objects
.
filter
(
parent
=
pk
)
children
=
Item
.
objects
.
filter
(
parent
=
pk
,
is_deleted
=
False
)
children_data
=
serializers
.
serialize
(
"json"
,
children
)
json_children
=
json
.
loads
(
children_data
)
parent
=
Item
.
objects
.
filter
(
item_id
=
pk
)
#item
...
...
@@ -169,7 +169,7 @@ class ItemViewSet(viewsets.ViewSet):
res
[
'list'
]
=
children_list
return
Response
({
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
if
request
.
method
==
'POST'
:
name
=
request
.
POST
.
get
(
'name'
,
''
함
)
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
()
...
...
@@ -219,4 +219,4 @@ class SharedItemViewSet(viewsets.ModelViewSet):
item
=
ItemViewSet
.
as_view
({
'delete'
:
'destroy'
,
})
\ No newline at end of file
})
...
...
Please
register
or
login
to post a comment