Merge branch 'master' into 0.8M
Conflicts: AUTHORS docs/django.rst mongoengine/base.py mongoengine/queryset.py tests/fields/fields.py tests/queryset/queryset.py tests/test_dereference.py tests/test_document.py
This commit is contained in:
@@ -609,8 +609,11 @@ class QuerySet(object):
|
||||
.. versionchanged:: 0.6 - Improved db_field refrence handling
|
||||
"""
|
||||
queryset = self.clone()
|
||||
return queryset._dereference(queryset._cursor.distinct(field), 1,
|
||||
name=field, instance=queryset._document)
|
||||
try:
|
||||
field = self._fields_to_dbfields([field]).pop()
|
||||
finally:
|
||||
return self._dereference(queryset._cursor.distinct(field), 1,
|
||||
name=field, instance=self._document)
|
||||
|
||||
def only(self, *fields):
|
||||
"""Load only a subset of this document's fields. ::
|
||||
@@ -696,7 +699,7 @@ class QuerySet(object):
|
||||
prefixed with **+** or **-** to determine the ordering direction
|
||||
"""
|
||||
queryset = self.clone()
|
||||
queryset._ordering = self._get_order_by(keys)
|
||||
queryset._ordering = queryset._get_order_by(keys)
|
||||
return queryset
|
||||
|
||||
def explain(self, format=False):
|
||||
|
||||
@@ -32,7 +32,7 @@ class SimplificationVisitor(QNodeVisitor):
|
||||
if combination.operation == combination.AND:
|
||||
# The simplification only applies to 'simple' queries
|
||||
if all(isinstance(node, Q) for node in combination.children):
|
||||
queries = [node.query for node in combination.children]
|
||||
queries = [n.query for n in combination.children]
|
||||
return Q(**self._query_conjunction(queries))
|
||||
return combination
|
||||
|
||||
|
||||
Reference in New Issue
Block a user