Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
La Quadrature du Net
piphone
campaign
Commits
9441e3c8
Commit
9441e3c8
authored
Feb 11, 2019
by
Okhin
Browse files
Getting the email from the mail field
parent
28bcab73
Pipeline
#2434
passed with stages
in 2 minutes and 25 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
picampaign/campaign/serializers.py
View file @
9441e3c8
...
...
@@ -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.
e
mail'
)
email
=
serializers
.
ReadOnlyField
(
source
=
'contact.mail'
)
twitter
=
serializers
.
ReadOnlyField
(
source
=
'contact.twitter'
)
photo
=
serializers
.
ReadOnlyField
(
source
=
'contact.get_photo_url'
)
...
...
picampaign/campaign/test_views.py
View file @
9441e3c8
...
...
@@ -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
()
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment