Got within_box working for Geo fields
This commit is contained in:
parent
1c334141ee
commit
71689fcf23
@ -2,6 +2,20 @@
|
|||||||
Changelog
|
Changelog
|
||||||
=========
|
=========
|
||||||
|
|
||||||
|
Changes in v0.4
|
||||||
|
===============
|
||||||
|
- Added ``SortedListField``
|
||||||
|
- Added ``EmailField``
|
||||||
|
- Added ``GeoLocationField``
|
||||||
|
- Added ``exact`` and ``iexact`` match operators to ``QuerySet``
|
||||||
|
- Added ``get_document_or_404`` and ``get_list_or_404`` Django shortcuts
|
||||||
|
- Fixed bug in Q-objects
|
||||||
|
- Fixed document inheritance primary key issue
|
||||||
|
- Base class can now be defined for ``DictField``
|
||||||
|
- Fixed MRO error that occured on document inheritance
|
||||||
|
- Introduced ``min_length`` for ``StringField``
|
||||||
|
- Other minor fixes
|
||||||
|
|
||||||
Changes in v0.3
|
Changes in v0.3
|
||||||
===============
|
===============
|
||||||
- Added MapReduce support
|
- Added MapReduce support
|
||||||
|
@ -351,6 +351,8 @@ class QuerySet(object):
|
|||||||
value = {'$within': {'$center': value}}
|
value = {'$within': {'$center': value}}
|
||||||
elif op == "near":
|
elif op == "near":
|
||||||
value = {'$near': value}
|
value = {'$near': value}
|
||||||
|
elif op == 'within_box':
|
||||||
|
value = {'$within': {'$box': value}}
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError("Geo method '%s' has not "
|
raise NotImplementedError("Geo method '%s' has not "
|
||||||
"been implemented" % op)
|
"been implemented" % op)
|
||||||
|
@ -1232,6 +1232,12 @@ class QuerySetTest(unittest.TestCase):
|
|||||||
events = events.order_by("-date")
|
events = events.order_by("-date")
|
||||||
self.assertEqual(events.count(), 2)
|
self.assertEqual(events.count(), 2)
|
||||||
self.assertEqual(events[0], event3)
|
self.assertEqual(events[0], event3)
|
||||||
|
|
||||||
|
# check that within_box works
|
||||||
|
box = [(35.0, -125.0), (40.0, -100.0)]
|
||||||
|
events = Event.objects(location__within_box=box)
|
||||||
|
self.assertEqual(events.count(), 1)
|
||||||
|
self.assertEqual(events[0].id, event2.id)
|
||||||
|
|
||||||
Event.drop_collection()
|
Event.drop_collection()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user