Permalink
Browse files

Merge pull request #459 from groovecoder/page-title-in-map-api-332

fixes #332 - include full page data in maps api
  • Loading branch information...
2 parents 45b20d2 + b87b02a commit 79617d7c494717d161fd768f63ff3d8ecebec6ac @philipn philipn committed Mar 26, 2013
Showing with 14 additions and 1 deletion.
  1. +8 −0 docs/source/api.rst
  2. +1 −1 sapling/maps/api.py
  3. +5 −0 sapling/pages/api.py
View
@@ -333,6 +333,14 @@ List
/api/map/
+Parameters
+__________
+
+full
+
+* `False`: (default) pages for maps are returned as links
+* `True`: pages for maps are returned in full (see `Pages`_ example object)
+
Fetch
~~~~~
View
@@ -11,7 +11,7 @@
class MapResource(pages.api.PageURLMixin, gis_resources.ModelResource):
- page = fields.ToOneField('pages.api.PageResource', 'page')
+ page = fields.ToOneField('pages.api.PageResource', 'page', full=True)
class Meta:
queryset = MapData.objects.all()
View
@@ -167,6 +167,11 @@ def get_search(self, request, **kwargs):
self.log_throttled_access(request)
return self.create_response(request, object_list)
+ def dehydrate(self, bundle):
+ if not bundle.request.GET.get('full'):
+ bundle = bundle.data['resource_uri']
+ return bundle
+
# We don't use the PageURLMixin approach here because it becomes
# too complicated to generate pretty URLs with the historical version

0 comments on commit 79617d7

Please sign in to comment.