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-15 18:41:59 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d84348012ebda25404ecdd5e8e000981973b224f
d8434801
1 parent
c36dbd3e
implement delete permanently api
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletions
backend/api/views.py
backend/khudrive/urls.py
backend/api/views.py
View file @
d843480
...
...
@@ -221,6 +221,16 @@ class ItemViewSet(viewsets.ViewSet):
return
Response
({
'message'
:
'restore complete'
},
status
=
status
.
HTTP_200_OK
)
return
Response
({
'message'
:
'item is not existed.'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
@action
(
methods
=
[
'DELETE'
],
detail
=
True
,
permission_classes
=
[
AllowAny
],
url_path
=
'delete'
,
url_name
=
'delete'
)
def
delete
(
self
,
request
,
pk
):
if
request
.
method
==
'DELETE'
:
item
=
get_object_or_None
(
Item
,
item_id
=
pk
)
if
item
!=
None
:
if
item
.
is_folder
==
True
:
# 폴더는 삭제 안되도록 처리
return
Response
({
'message'
:
'This item is folder.'
},
status
=
status
.
HTTP_200_OK
)
item
.
delete
()
return
Response
({
'message'
:
'delete permanently complete'
},
status
=
status
.
HTTP_200_OK
)
return
Response
({
'message'
:
'item is not existed.'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
# url: items/11/move
# 마지막 slash도 써주어야함
...
...
backend/khudrive/urls.py
View file @
d843480
...
...
@@ -30,7 +30,7 @@ urlpatterns = [
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
''
,
include
(
router
.
urls
)),
url
(
r'^search/$'
,
views
.
ItemViewSet
.
search
,
name
=
'search'
),
#
url(r'^<int:pk>/delete/$', views.ItemViewSet.delete, name='delete'),
url
(
r'^<int:pk>/delete/$'
,
views
.
ItemViewSet
.
delete
,
name
=
'delete'
),
url
(
r'^<int:pk>/restore/$'
,
views
.
ItemViewSet
.
restore
,
name
=
'restore'
),
url
(
r'^<int:pk>/share/$'
,
views
.
SharedItemViewSet
.
share
,
name
=
'share'
),
url
(
r'^<int:pk>/move/$'
,
views
.
ItemViewSet
.
move
,
name
=
'move'
),
...
...
Please
register
or
login
to post a comment