serializers.py 920 Bytes
Newer Older
Sli's avatar
Sli committed
1
from rest_framework import serializers
Sli's avatar
Sli committed
2
from counter.models import Counter
Sli's avatar
Sli committed
3
from core.models import User, RealGroup
4
from club.models import Club
Sli's avatar
Sli committed
5
6


7
class CounterRead(serializers.ModelSerializer):
Sli's avatar
Sli committed
8
9

    is_open = serializers.BooleanField(read_only=True)
Skia's avatar
Skia committed
10
    barman_list = serializers.ListField(
11
            child=serializers.IntegerField()
Skia's avatar
Skia committed
12
            )
Sli's avatar
Sli committed
13
14
15

    class Meta:
        model = Counter
Skia's avatar
Skia committed
16
17
        fields = ('id', 'name', 'type', 'is_open', 'barman_list')

18
19
20
21
22

class UserRead(serializers.ModelSerializer):

    class Meta:
        model = User
Sli's avatar
Sli committed
23
24
        fields = ('id', 'first_name', 'last_name', 'email',
                  'date_of_birth', 'nick_name', 'is_active', 'date_joined')
25
26
27
28
29
30


class ClubRead(serializers.ModelSerializer):

    class Meta:
        model = Club
Sli's avatar
Sli committed
31
        fields = ('id', 'name', 'unix_name', 'address', 'members')
32
33
34
35
36


class GroupRead(serializers.ModelSerializer):

    class Meta:
Sli's avatar
Sli committed
37
        model = RealGroup