fixes #332 - include full page data in maps api #459

Merged
merged 1 commit into from Mar 26, 2013
Jump to file or symbol
Failed to load files and symbols.
+14 −1
Split
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