Commit f679b4d8 by dgrtwo

Added support and brief documentation of nearSphere operator for GeoPoints

parent e3f4a105
...@@ -283,6 +283,13 @@ Like Django, Querysets can have constraints added by appending the name of the f ...@@ -283,6 +283,13 @@ Like Django, Querysets can have constraints added by appending the name of the f
high_scores = GameScore.Query.filter(score__gte=1000) high_scores = GameScore.Query.filter(score__gte=1000)
~~~~~ ~~~~~
You can similarly perform queries on GeoPoint objects by using the `nearSphere` operator:
~~~~~ {python}
my_loc = GeoPoint(latitude=12.0, longitude=-34.55)
nearby_restaurants = Restaurant.Query.filter(location__nearSphere=my_loc)
~~~~~
You can see the [full list of constraint operators defined by You can see the [full list of constraint operators defined by
Parse](https://www.parse.com/docs/rest#queries-constraints) Parse](https://www.parse.com/docs/rest#queries-constraints)
......
...@@ -56,7 +56,7 @@ class QueryManager(object): ...@@ -56,7 +56,7 @@ class QueryManager(object):
class Queryset(object): class Queryset(object):
OPERATORS = [ OPERATORS = [
'lt', 'lte', 'gt', 'gte', 'ne', 'in', 'nin', 'exists', 'select', 'dontSelect', 'all', 'relatedTo' 'lt', 'lte', 'gt', 'gte', 'ne', 'in', 'nin', 'exists', 'select', 'dontSelect', 'all', 'relatedTo', 'nearSphere'
] ]
@staticmethod @staticmethod
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment