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