Sith/api/views/serializers.py

35 lines
709 B
Python
Raw Normal View History

2016-08-04 22:50:48 +00:00
from rest_framework import serializers
2016-08-05 18:01:23 +00:00
from counter.models import Counter
from core.models import User, Group
from club.models import Club
2016-08-05 18:01:23 +00:00
class CounterRead(serializers.ModelSerializer):
2016-08-05 18:01:23 +00:00
is_open = serializers.BooleanField(read_only=True)
2016-08-06 10:37:36 +00:00
barman_list = serializers.ListField(
child=serializers.IntegerField()
2016-08-06 10:37:36 +00:00
)
2016-08-05 18:01:23 +00:00
class Meta:
model = Counter
2016-08-06 10:37:36 +00:00
fields = ('id', 'name', 'type', 'is_open', 'barman_list')
class UserRead(serializers.ModelSerializer):
class Meta:
model = User
class ClubRead(serializers.ModelSerializer):
class Meta:
model = Club
class GroupRead(serializers.ModelSerializer):
class Meta:
model = Group