Skip to content

Commit

Permalink
[Fix #124] Inline primary_location data for Project and Organisation in
Browse files Browse the repository at this point in the history
the API

Add the data for the primary_location as full inline data in the
project and organisation API resources by default.
  • Loading branch information
zzgvh committed Nov 12, 2012
1 parent 88462b2 commit 8c5e820
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions akvo/api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,13 @@ class Meta:


class OrganisationResource(ConditionalFullResource):
partnerships = ConditionalFullToManyField(
partnerships = ConditionalFullToManyField(
'akvo.api.resources.PartnershipResource',
'partnerships',
help_text='Show the projects the organisation is related to and how.'
)
locations = ConditionalFullToManyField('akvo.api.resources.OrganisationLocationResource', 'locations')
locations = ConditionalFullToManyField('akvo.api.resources.OrganisationLocationResource', 'locations')
primary_location = fields.ToOneField('akvo.api.resources.OrganisationLocationResource', 'primary_location', full=True)

class Meta:
allowed_methods = ['get']
Expand Down Expand Up @@ -341,6 +342,7 @@ class ProjectResource(ConditionalFullResource):
links = ConditionalFullToManyField('akvo.api.resources.LinkResource', 'links')
locations = ConditionalFullToManyField('akvo.api.resources.ProjectLocationResource', 'locations')
partnerships = ConditionalFullToManyField('akvo.api.resources.PartnershipResource', 'partnerships',)
primary_location = fields.ToOneField('akvo.api.resources.ProjectLocationResource', 'primary_location', full=True)
project_comments = ConditionalFullToManyField('akvo.api.resources.ProjectCommentResource', 'comments')
project_updates = ConditionalFullToManyField('akvo.api.resources.ProjectUpdateResource', 'project_updates')

Expand Down

0 comments on commit 8c5e820

Please sign in to comment.