serializers.py 430 Bytes
Newer Older
1
from picampaign.organization.models import FeedbackCategory, Group
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 13 14 15 16 17


class GroupSerializer(serializers.ModelSerializer):
    type = serializers.Field(source='type.name')

    class Meta:
        model = Group
        fields = ('type', 'name', 'media')