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-10 20:45:39 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
197b11463916c4135f0e5e738f4fef69b035dccf
197b1146
1 parent
35ac2641
fix the response object
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
backend/api/views.py
backend/api/views.py
View file @
197b114
...
...
@@ -45,7 +45,12 @@ class ItemViewSet(viewsets.ViewSet):
data
=
serializers
.
serialize
(
"json"
,
item_list
)
json_data
=
json
.
loads
(
data
)
return
Response
({
'data'
:
{
'list'
:
json_data
}},
status
=
status
.
HTTP_200_OK
)
res
=
[]
for
i
in
json_data
:
t
=
i
[
'fields'
]
t
[
'id'
]
=
i
[
'pk'
]
res
.
append
(
t
)
return
Response
({
'data'
:
{
'list'
:
res
}},
status
=
status
.
HTTP_200_OK
)
# url: items/11/
# 마지막 slash도 써주어야함
...
...
@@ -136,7 +141,10 @@ class SharedItemViewSet(viewsets.ModelViewSet):
item_json
=
serializers
.
serialize
(
"json"
,
item
)
json_data
=
json
.
loads
(
item_json
)
return
Response
({
"shared"
:
sharedfile
.
created_time
,
'data'
:
json_data
},
status
=
status
.
HTTP_200_OK
)
print
(
json_data
)
res
=
json_data
[
0
][
'fields'
]
res
[
'id'
]
=
json_data
[
0
][
'pk'
]
return
Response
({
"shared"
:
sharedfile
.
created_time
,
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
item
=
ItemViewSet
.
as_view
({
'delete'
:
'destroy'
,
...
...
Please
register
or
login
to post a comment