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-09 22:48:35 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c6fa0f894e2f8dc3a30e8a4807991ea38f3b6120
c6fa0f89
1 parent
6a7261b5
implement destroy item api
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
backend/api/views.py
backend/api/views.py
View file @
c6fa0f8
...
...
@@ -58,13 +58,13 @@ class ItemViewSet(viewsets.ViewSet):
def
destroy
(
self
,
request
,
pk
):
if
request
.
method
==
'DELETE'
:
print
(
pk
)
# keyword = request.GET.get('keyword', ''
)
# item_list = Item.objects.filter(name__icontains=keyword)
#
# data = serializers.serialize("json", item_list)
#
json_data = json.loads(data)
# return Response({'message': "delete complete"},
status=status.HTTP_200_OK)
return
Response
(
status
=
status
.
HTTP_204_NO_CONTENT
)
item
=
Item
.
objects
.
get
(
item_id
=
pk
)
if
item
.
is_folder
==
True
:
# 폴더는 삭제 안되도록 처리
return
Response
({
'message'
:
'This item is folder.'
},
status
=
status
.
HTTP_200_OK
)
item
.
is_deleted
=
True
#
item.delete() 이거 하면 완전 삭제되어버림 is deleted True 면 휴지통에서 리스트 조회할 수 있도록!
return
Response
({
'message'
:
'delete complete'
},
status
=
status
.
HTTP_200_OK
)
return
Response
(
{
'message'
:
'item is not existed.'
},
status
=
status
.
HTTP_204_NO_CONTENT
)
def
get_permissions
(
self
):
try
:
...
...
Please
register
or
login
to post a comment