Commit fc55cd4e authored by Aymeric Barantal's avatar Aymeric Barantal
Browse files

expand groups on contacts list for a campaign

parent 3f60b63e
from picampaign.campaign.models import (Campaign, CampaignContact,
from picampaign.organization.serializers import GroupSerializer
from rest_framework import serializers
......@@ -22,7 +23,7 @@ class CampaignContactSerializer(serializers.HyperlinkedModelSerializer):
first_name = serializers.Field(source='contact.first_name')
last_name = serializers.Field(source='contact.last_name')
phone = serializers.Field(source='')
groups = serializers.Field(source='all_groups')
groups = GroupSerializer(many=True, source='contact.groups')
contact_id = serializers.Field(source='')
class Meta:
from picampaign.organization.models import FeedbackCategory
from picampaign.organization.models import FeedbackCategory, Group
from rest_framework import serializers
......@@ -7,3 +7,11 @@ class CategorySerializer(serializers.ModelSerializer):
class Meta:
model = FeedbackCategory
fields = ('id', 'name')
class GroupSerializer(serializers.ModelSerializer):
type = serializers.Field(source='')
class Meta:
model = Group
fields = ('type', 'name', 'media')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment