Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

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

Merged
merged 1 commit into from

2 participants

@groovecoder
Collaborator

No description provided.

@groovecoder
Collaborator

Updated to make the /map/ endpoint accept a pages_full parameter to control whether or not full page data is included.

@philipn
Owner

Looks good! Maybe we should use &full=True instead? That way people could use it to unroll other things later.

@groovecoder
Collaborator

Updated.

@philipn philipn merged commit 79617d7 into localwiki:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 26, 2013
  1. @groovecoder
This page is out of date. Refresh to see the latest.
View
8 docs/source/api.rst
@@ -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
2  sapling/maps/api.py
@@ -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
5 sapling/pages/api.py
@@ -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
Something went wrong with that request. Please try again.