Commit 9441e3c8 authored by okhin's avatar okhin 🚴

Getting the email from the mail field

parent 28bcab73
Pipeline #2434 passed with stages
in 2 minutes and 25 seconds
......@@ -31,7 +31,7 @@ class CampaignContactSerializer(serializers.HyperlinkedModelSerializer):
phone = PhoneSerializer(many=True, source='contact.phones')
groups = GroupSerializer(many=True, source='contact.groups')
contact_id = serializers.ReadOnlyField(source='contact.id')
email = serializers.ReadOnlyField(source='contact.email')
email = serializers.ReadOnlyField(source='contact.mail')
twitter = serializers.ReadOnlyField(source='contact.twitter')
photo = serializers.ReadOnlyField(source='contact.get_photo_url')
......
......@@ -46,7 +46,7 @@ class ViewSetTest(TestCase):
client = APIClient()
response = client.get('/campaigns/%(cid)d/contacts/' % {'cid': self.campaign.id}, format='json')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.content, b'[{"id":1,"weight":0,"contact_id":1,"full_name":"Victor Hugo","first_name":"Victor","last_name":"Hugo","phone":["0123456789"],"groups":[],"photo":"","twitter":""}]')
self.assertEqual(response.content, b'[{"id":1,"weight":0,"contact_id":1,"full_name":"Victor Hugo","first_name":"Victor","last_name":"Hugo","phone":["0123456789"],"groups":[],"photo":"","email":"","twitter":""}]')
def test_campaign_argumentary_viewset(self):
client = APIClient()
......
Markdown is supported
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