Got within_box working for Geo fields
This commit is contained in:
parent
1c334141ee
commit
71689fcf23
@ -2,6 +2,20 @@
|
||||
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
|
||||
===============
|
||||
- Added MapReduce support
|
||||
|
@ -351,6 +351,8 @@ class QuerySet(object):
|
||||
value = {'$within': {'$center': value}}
|
||||
elif op == "near":
|
||||
value = {'$near': value}
|
||||
elif op == 'within_box':
|
||||
value = {'$within': {'$box': value}}
|
||||
else:
|
||||
raise NotImplementedError("Geo method '%s' has not "
|
||||
"been implemented" % op)
|
||||
|
@ -1233,6 +1233,12 @@ class QuerySetTest(unittest.TestCase):
|
||||
self.assertEqual(events.count(), 2)
|
||||
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()
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user