serializers.py 774 Bytes
Newer Older
okhin's avatar
okhin committed
1
from picampaign.organization.models import FeedbackCategory, Group, GroupType, Organization
2
3
4
5
6
7
8
9
from rest_framework import serializers


class CategorySerializer(serializers.ModelSerializer):

    class Meta:
        model = FeedbackCategory
        fields = ('id', 'name')
10
11
12


class GroupSerializer(serializers.ModelSerializer):
13
    type = serializers.ReadOnlyField(source='type.name')
14
15
16

    class Meta:
        model = Group
okhin's avatar
okhin committed
17
        fields = ('id', 'type', 'name', 'media')
okhin's avatar
okhin committed
18

okhin's avatar
okhin committed
19

okhin's avatar
okhin committed
20
21
22
23
class GroupTypeSerializer(serializers.ModelSerializer):
    class Meta:
        model = GroupType
        fields = ('id', 'name')
okhin's avatar
okhin committed
24
25
26
27
28
29


class OrganizationSerializer(serializers.ModelSerializer):
    class Meta:
        model = Organization
        fields = ('id', 'name', 'description', 'website', 'logo',)