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 22:05:16 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
ed3290688d5ddd2cfeab12368a3c500cca84ca61
ed329068
2 parents
afb8ed5b
2ab96cb2
Merge branch 'develop' into feature/frontend
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
backend/api/views.py
backend/api/views.py
View file @
ed32906
...
...
@@ -299,7 +299,8 @@ class ItemViewSet(viewsets.ViewSet):
return
Response
({
'message'
:
'item is not existed.'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
if
child
.
is_folder
==
True
:
return
Response
({
'message'
:
'item is folder'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
copiedName
=
child
.
name
+
"_복사본_"
+
str
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
))
name
=
child
.
name
.
split
(
"."
)
copiedName
=
name
[
0
]
+
"_복사본_"
+
str
(
datetime
.
now
()
.
strftime
(
'
%
Y-
%
m-
%
d
%
H:
%
M'
))
+
"."
+
name
[
-
1
]
copiedItem
=
Item
(
is_folder
=
False
,
name
=
copiedName
,
path
=
child
.
path
,
parent
=
parent_id
,
user_id
=
child
.
user_id
,
size
=
child
.
size
,
status
=
child
.
status
)
copiedItem
.
save
()
...
...
@@ -398,6 +399,7 @@ 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
)
...
...
@@ -407,7 +409,7 @@ class ItemViewSet(viewsets.ViewSet):
presigned_post
=
s3
.
generate_presigned_post
(
s3_bucket
,
file_
name
,
file_
id
,
{
"acl"
:
"private"
,
"Content-Type"
:
file_type
,
...
...
@@ -434,7 +436,7 @@ class ItemViewSet(viewsets.ViewSet):
data
=
{
"signed_url"
:
presigned_post
,
'url'
:
'
%
s/
%
s'
%
(
presigned_post
[
"url"
],
file_
name
),
'url'
:
'
%
s/
%
s'
%
(
presigned_post
[
"url"
],
file_
id
),
'item'
:
res
}
...
...
Please
register
or
login
to post a comment