Toggle navigation
Toggle navigation
This project
Loading...
Sign in
cse437_e
/
smartdoorlock-backend
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
김유현
2020-11-24 08:22:22 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
75849b1fce42a58660ac925bd5a70b9f40d961cb
75849b1f
1 parent
7b8f80a7
Modify set api
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
api/views.py
api/views.py
View file @
75849b1
...
...
@@ -363,11 +363,21 @@ class Recording(APIView) :
raise
PermissionDenied
print
(
request
.
body
)
data
=
json
.
loads
(
request
.
body
)
if
'recording'
not
in
data
:
raise
FieldDoesNotExist
target
=
Record
.
objects
.
filter
(
id
=
1
)
target
.
update
(
recording
=
data
[
'recording'
])
return
Response
(
status
=
status
.
HTTP_200_OK
)
res
=
{
'recording'
:
data
[
'recording'
]
}
return
Response
(
res
,
status
=
status
.
HTTP_200_OK
)
except
PermissionDenied
as
error
:
return
Response
({
'error'
:
"PermissionDenied "
,
'date'
:
datetime
.
now
()
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
except
FieldDoesNotExist
as
error
:
return
Response
({
'error'
:
"FieldDoesNotExist "
,
'date'
:
datetime
.
now
()
},
status
=
status
.
HTTP_400_BAD_REQUEST
)
...
...
Please
register
or
login
to post a comment