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-17 23:27:08 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
4c475b80cfcd1a222fcc4f523f4ad7ffae1a0d2e
4c475b80
2 parents
2ab96cb2
63b1a5ad
Merge branch 'feature/frontend' into develop
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
4 deletions
backend/api/views.py
backend/api/views.py
View file @
4c475b8
...
...
@@ -195,7 +195,7 @@ class ItemViewSet(viewsets.ViewSet):
s3_bucket
=
AWS_STORAGE_BUCKET_NAME
item
=
Item
.
objects
.
filter
(
item_id
=
pk
)
object_name
=
item
.
get
()
.
name
object_name
=
str
(
item
.
get
()
.
item_id
)
data
=
serializers
.
serialize
(
"json"
,
item
)
json_data
=
json
.
loads
(
data
)
...
...
@@ -399,12 +399,13 @@ class ItemViewSet(viewsets.ViewSet):
# 파일 객체 생성
file_name
=
request
.
POST
.
get
(
'name'
,
''
)
file_size
=
request
.
POST
.
get
(
'size'
,
''
)
file_id
=
request
.
POST
.
get
(
'item_id'
,
''
)
file_parent
=
pk
file_type
=
mimetypes
.
guess_type
(
file_name
)[
0
]
upload_item
=
Item
(
name
=
file_name
,
size
=
file_size
,
user_id
=
1
,
file_type
=
file_type
,
parent
=
file_parent
)
upload_item
.
save
()
file_id
=
str
(
upload_item
.
item_id
)
date_long
=
datetime
.
utcnow
()
.
strftime
(
'
%
Y
%
m
%
dT000000Z'
)
presigned_post
=
s3
.
generate_presigned_post
(
...
...
@@ -478,7 +479,6 @@ class SharedItemViewSet(viewsets.ModelViewSet):
return
Response
({
'message'
:
'This file is already shared'
},
status
=
status
.
HTTP_200_OK
)
sharedfile
=
SharedItem
(
item_id
=
pk
,
password
=
password
,
expires
=
expires
)
sharedfile
.
save
()
sharedfile
=
SharedItem
.
objects
.
get
(
item_id
=
pk
)
# sf = serializers.serialize("json", sharedfile)
item
=
Item
.
objects
.
filter
(
item_id
=
pk
)
...
...
@@ -488,7 +488,7 @@ class SharedItemViewSet(viewsets.ModelViewSet):
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
)
return
Response
({
"shared"
:
sharedfile
.
pk
,
'data'
:
res
},
status
=
status
.
HTTP_200_OK
)
item
=
ItemViewSet
.
as_view
({
...
...
Please
register
or
login
to post a comment