Skip to content
This repository has been archived by the owner on Nov 19, 2021. It is now read-only.

Commit

Permalink
extend map api
Browse files Browse the repository at this point in the history
  • Loading branch information
smellman committed Jan 19, 2013
1 parent eb4c537 commit 55d8417
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions sapling/maps/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ class Meta:
authentication = ApiKeyWriteAuthentication()
authorization = DjangoAuthorization()

class MapWithPageResource(pages.api.PageURLMixin, gis_resources.ModelResource):
page = fields.ToOneField('pages.api.PageResource', 'page', full=True)

class Meta:
queryset = MapData.objects.all()
resource_name = 'map_with_page'
detail_uri_name = 'page__name'
filtering = {
'page': ALL_WITH_RELATIONS,
'points': ALL,
'lines': ALL,
'polys': ALL,
'geom': ALL,
'length': ALL,
}
list_allowed_methods = ['get']
authentication = ApiKeyWriteAuthentication()
authorization = DjangoAuthorization()


# We don't use detail_uri_name here because it becomes too complicated
# to generate pretty URLs with the historical version identifers.
Expand All @@ -53,3 +72,4 @@ class Meta:

api.register(MapResource())
api.register(MapHistoryResource())
api.register(MapWithPageResource())

0 comments on commit 55d8417

Please sign in to comment.