-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e315be
commit 04fd1bf
Showing
5 changed files
with
85 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
try: | ||
from collections import OrderedDict | ||
# python 2.6 | ||
except ImportError: # pragma: no cover | ||
from ordereddict import OrderedDict | ||
|
||
from rest_framework import pagination | ||
from rest_framework.response import Response | ||
|
||
|
||
class GeoJsonPagination(pagination.PageNumberPagination): | ||
""" | ||
A geoJSON implementation of a pagination serializer. | ||
""" | ||
def get_paginated_response(self, data): | ||
return Response(OrderedDict([ | ||
('type', 'FeatureCollection'), | ||
('count', self.page.paginator.count), | ||
('next', self.get_next_link()), | ||
('previous', self.get_previous_link()), | ||
('features', data['features']) | ||
])) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters