ReferenceField query chaining bug fixed.

This commit is contained in:
Aleksandr Sorokoumov 2013-03-16 16:47:22 +01:00
parent 9f58bc9207
commit a192029901

View File

@ -367,6 +367,10 @@ class QuerySet(object):
self._skip = None self._skip = None
self._hint = -1 # Using -1 as None is a valid value for hint self._hint = -1 # Using -1 as None is a valid value for hint
def __deepcopy__(self, memo):
"""Essential for chained queries with ReferenceFields involved"""
return self.clone()
def clone(self): def clone(self):
"""Creates a copy of the current :class:`~mongoengine.queryset.QuerySet` """Creates a copy of the current :class:`~mongoengine.queryset.QuerySet`
@ -814,7 +818,6 @@ class QuerySet(object):
mongo_query['$and'].append(value) mongo_query['$and'].append(value)
else: else:
mongo_query['$and'] = value mongo_query['$and'] = value
return mongo_query return mongo_query
def get(self, *q_objs, **query): def get(self, *q_objs, **query):