fix location Data
This commit is contained in:
parent
aa722fdc9c
commit
7bfaefa41f
@ -18,8 +18,8 @@ class TableAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
|
||||
|
||||
@admin.register(TmpLocationData)
|
||||
class TmpLocationDataAdmin(admin.ModelAdmin):
|
||||
@admin.register(LocationData)
|
||||
class LocationDataAdmin(admin.ModelAdmin):
|
||||
list_display = ('location_id', 'table_no', 'tst', 'on_off',)
|
||||
fields = ['location_id', 'table_no', 'tst', 'on_off',]
|
||||
pass
|
||||
|
@ -1,5 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.5 on 2017-01-06 18:09
|
||||
# Generated by Django 1.10.5 on 2017-01-06 19:24
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
@ -13,10 +13,10 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='TmpLocationData',
|
||||
name='LocationData',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('location_id', models.UUIDField(editable=False)),
|
||||
('location_id', models.CharField(max_length=32)),
|
||||
('table_no', models.IntegerField()),
|
||||
('tst', models.DateTimeField()),
|
||||
('on_off', models.BooleanField()),
|
@ -34,8 +34,8 @@ class Table(models.Model):
|
||||
return self.name
|
||||
|
||||
|
||||
class TmpLocationData(models.Model):
|
||||
location_id = models.UUIDField(blank=False, null=False)
|
||||
class LocationData(models.Model):
|
||||
location_id = models.CharField(max_length=32, blank=False, null=False)
|
||||
table_no = models.IntegerField(blank=False, null=False)
|
||||
tst = models.DateTimeField(blank=False, null=False)
|
||||
on_off = models.BooleanField(blank=False, null=False)
|
||||
|
@ -20,7 +20,7 @@ class TableSerializer(serializers.HyperlinkedModelSerializer):
|
||||
fields = ('client', 'number', 'name',)
|
||||
|
||||
|
||||
class TmpLocationDataSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class LocationDataSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class Meta:
|
||||
model = TmpLocationData
|
||||
model = LocationData
|
||||
fields = ('location_id', 'table_no', 'tst', 'on_off',)
|
||||
|
@ -6,8 +6,8 @@ router = routers.DefaultRouter()
|
||||
router.register(r'clients', views.ClientViewSet)
|
||||
router.register(r'locations', views.LocationViewSet)
|
||||
router.register(r'tables', views.TableViewSet)
|
||||
router.register(r'location_data', views.TmpLocationDataViewSet)
|
||||
router.register(r'location_data', views.LocationDataViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'api/v1/', include(router.urls)),
|
||||
]
|
||||
]
|
||||
|
@ -17,6 +17,6 @@ class TableViewSet(viewsets.ModelViewSet):
|
||||
serializer_class = TableSerializer
|
||||
|
||||
|
||||
class TmpLocationDataViewSet(viewsets.ModelViewSet):
|
||||
queryset = TmpLocationData.objects.all()
|
||||
serializer_class = TmpLocationDataSerializer
|
||||
class LocationDataViewSet(viewsets.ModelViewSet):
|
||||
queryset = LocationData.objects.all()
|
||||
serializer_class = LocationDataSerializer
|
||||
|
Loading…
Reference in New Issue
Block a user