carom-server/billard/serializers.py

27 lines
676 B
Python
Raw Normal View History

2017-01-06 19:11:29 +01:00
from billard.models import *
2017-01-03 19:55:01 +01:00
from rest_framework import serializers
class ClientSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Client
2017-01-06 18:59:05 +01:00
fields = ('id', 'location',)
2017-01-03 19:55:01 +01:00
class LocationSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Location
2017-01-06 18:59:05 +01:00
fields = ('name',)
2017-01-03 19:55:01 +01:00
class TableSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = Table
2017-01-06 18:59:05 +01:00
fields = ('client', 'number', 'name',)
2017-01-06 19:11:29 +01:00
2017-01-06 20:24:36 +01:00
class LocationDataSerializer(serializers.HyperlinkedModelSerializer):
2017-01-06 19:11:29 +01:00
class Meta:
2017-01-06 20:24:36 +01:00
model = LocationData
2017-01-06 19:11:29 +01:00
fields = ('location_id', 'table_no', 'tst', 'on_off',)