dahee kim

Change model configuration

from django.contrib import admin
from .models import Video, Device, History, Lock, Record, Door
from .models import Video, Device, RemoteHistory, Lock, Record, Door
# Register your models here.
admin.site.register(Door)
admin.site.register(Video)
admin.site.register(Device)
admin.site.register(History)
admin.site.register(RemoteHistory)
admin.site.register(Lock)
admin.site.register(Record)
\ No newline at end of file
......
......@@ -15,7 +15,8 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='Device',
fields=[
('rfid_id', models.CharField(max_length=255, primary_key=True, serialize=False)),
('device_id', models.AutoField(auto_created=True, primary_key=True, serialize=False))
('rfid_id', models.CharField(max_length=255)),
('created', models.DateTimeField(default=django.utils.timezone.now)),
],
),
......@@ -26,7 +27,7 @@ class Migration(migrations.Migration):
],
),
migrations.CreateModel(
name='History',
name='RemoteHistory',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('device_name', models.CharField(max_length=255)),
......
......@@ -7,7 +7,8 @@ class Door(models.Model) :
door_id = models.CharField(max_length = 255, primary_key = True)
class Device(models.Model) :
device_id = models.CharField(max_length = 255, primary_key = True)
device_id = models.AutoField(primary_key=True)
rfid_id = models.CharField(max_length = 255)
created = models.DateTimeField(default = timezone.now)
class Video(models.Model) :
......@@ -18,7 +19,7 @@ class Lock(models.Model) :
id = models.IntegerField(primary_key = True)
state = models.BooleanField(default = True)
class History(models.Model) :
class RemoteHistory(models.Model) :
device_name = models.CharField(max_length = 255)
ctrtime = models.DateTimeField(default = timezone.now)
......
from api.models import Device, Video, Lock, History, Record, Door
from api.models import Device, Video, Lock, RemoteHistory, Record, Door
from rest_framework import serializers
......@@ -12,9 +12,9 @@ class VideoSerializer(serializers.ModelSerializer) :
model = Video
fields = '__all__'
class HistorySerializer(serializers.ModelSerializer) :
class RemoteHistorySerializer(serializers.ModelSerializer) :
class Meta :
model = History
model = RemoteHistory
fields = '__all__'
class RecordSerializer(serializers.ModelSerializer) :
......