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-12 18:15:10 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ef348fa9540ac47c3302c14561b4b4d915445d4c
ef348fa9
1 parent
8d4ee69f
Update views.py
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
backend/api/views.py
backend/api/views.py
View file @
ef348fa
...
...
@@ -133,7 +133,8 @@ class ItemViewSet(viewsets.ViewSet):
def
search
(
self
,
request
):
if
request
.
method
==
'GET'
:
keyword
=
request
.
GET
.
get
(
'keyword'
,
''
)
item_list
=
Item
.
objects
.
filter
(
name__icontains
=
keyword
)
user_id
=
request
.
GET
.
get
(
'user_id'
,
''
)
item_list
=
Item
.
objects
.
filter
(
name__icontains
=
keyword
,
user_id
=
user_id
)
data
=
serializers
.
serialize
(
"json"
,
item_list
)
json_data
=
json
.
loads
(
data
)
...
...
@@ -260,8 +261,8 @@ class ItemViewSet(viewsets.ViewSet):
return
Response
({
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
if
request
.
method
==
'POST'
:
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
)
user_id
=
request
.
GET
.
get
(
'user_id'
,
''
)
item
=
Item
(
is_folder
=
True
,
name
=
name
,
file_type
=
"folder"
,
path
=
""
,
parent
=
pk
,
user_id
=
user_id
,
size
=
0
,
status
=
True
)
item
.
save
()
item
=
Item
.
objects
.
filter
(
item_id
=
item
.
item_id
)
item_data
=
serializers
.
serialize
(
"json"
,
item
)
...
...
Please
register
or
login
to post a comment