Now order_by() works like queries for referencing deeper fields (replacing . with __). old: order_by('mydoc.myattr') / new: order_by('mydoc__myattr'). Closes #45
This commit is contained in:
parent
6791f205af
commit
21d267cb11
@ -670,11 +670,13 @@ class QuerySet(object):
|
||||
"""
|
||||
key_list = []
|
||||
for key in keys:
|
||||
if not key: continue
|
||||
direction = pymongo.ASCENDING
|
||||
if key[0] == '-':
|
||||
direction = pymongo.DESCENDING
|
||||
if key[0] in ('-', '+'):
|
||||
key = key[1:]
|
||||
key = key.replace('__', '.')
|
||||
key_list.append((key, direction))
|
||||
|
||||
self._ordering = key_list
|
||||
|
Loading…
x
Reference in New Issue
Block a user