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-10-20 20:20:21 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a1aa7c78f2db7dd1a3377c9c63df29339ef2bb75
a1aa7c78
1 parent
0258df7e
redress error
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
8 deletions
api/admin.py
api/models.py
api/views.py
src/urls.py
api/admin.py
View file @
a1aa7c7
from
django.contrib
import
admin
from
.models
import
Video
,
Phone
from
.models
import
Video
,
Device
,
History
,
Lock
# Register your models here.
admin
.
site
.
register
(
Video
)
admin
.
site
.
register
(
Phone
)
\ No newline at end of file
admin
.
site
.
register
(
Device
)
admin
.
site
.
register
(
History
)
admin
.
site
.
register
(
Lock
)
\ No newline at end of file
...
...
api/models.py
View file @
a1aa7c7
...
...
@@ -17,5 +17,5 @@ class Lock(models.Model) :
state
=
models
.
BooleanField
(
default
=
True
)
class
History
(
models
.
Model
)
:
device
=
ForeignKey
(
Device
,
on_delete
=
models
.
CASCADE
)
ctrtime
=
created
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
\ No newline at end of file
device
=
models
.
ForeignKey
(
Device
,
on_delete
=
models
.
CASCADE
)
ctrtime
=
models
.
DateTimeField
(
default
=
timezone
.
now
)
\ No newline at end of file
...
...
api/views.py
View file @
a1aa7c7
...
...
@@ -4,8 +4,8 @@ from django.core import serializers
from
django.core.exceptions
import
FieldDoesNotExist
,
ObjectDoesNotExist
from
django.shortcuts
import
render
from
api.models
import
Video
,
Phone
from
api.serializers
import
VideoSerializer
,
Phone
Serializer
from
api.models
import
Video
,
Device
,
History
,
Lock
from
api.serializers
import
VideoSerializer
,
DeviceSerializer
,
History
Serializer
from
rest_framework
import
status
from
rest_framework.views
import
APIView
...
...
src/urls.py
View file @
a1aa7c7
...
...
@@ -20,6 +20,6 @@ from api import views
urlpatterns
=
[
path
(
'admin/'
,
admin
.
site
.
urls
),
path
(
'
api/
video/<str:vidname>/'
,
views
.
Video
.
as_view
()),
path
(
'
api/
checkDate/'
,
views
.
CheckDate
.
as_view
()),
path
(
'video/<str:vidname>/'
,
views
.
Video
.
as_view
()),
path
(
'checkDate/'
,
views
.
CheckDate
.
as_view
()),
]
...
...
Please
register
or
login
to post a comment