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 21:20:12 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
4c09d4773e55427529c23e057369896612efe5f7
4c09d477
2 parents
a4d70424
75849b1f
Merge branch 'master' of
http://khuhub.khu.ac.kr/cse437_e/smartdoorlock-backend
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletions
api/views.py
api/views.py
View file @
4c09d47
...
...
@@ -366,11 +366,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