Skip to content
GitLab
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
fc55cd4e
Commit
fc55cd4e
authored
Nov 22, 2014
by
Aymeric Barantal
Browse files
expand groups on contacts list for a campaign
parent
3f60b63e
Changes
2
Hide whitespace changes
Inline
Side-by-side
picampaign/campaign/serializers.py
View file @
fc55cd4e
from
picampaign.campaign.models
import
(
Campaign
,
CampaignContact
,
Argumentary
)
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
=
'contact.phone'
)
groups
=
s
erializer
s
.
Field
(
source
=
'all_
groups'
)
groups
=
GroupS
erializer
(
many
=
True
,
source
=
'contact.
groups'
)
contact_id
=
serializers
.
Field
(
source
=
'contact.id'
)
class
Meta
:
...
...
picampaign/organization/serializers.py
View file @
fc55cd4e
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
=
'type.name'
)
class
Meta
:
model
=
Group
fields
=
(
'type'
,
'name'
,
'media'
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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