Added no_dereference context manager (#82)

Reorganised the context_managers as well
This commit is contained in:
Ross Lawley
2013-01-23 19:05:44 +00:00
parent 4f70c27b56
commit 3a6dc77d36
16 changed files with 289 additions and 128 deletions

View File

@@ -779,7 +779,7 @@ class ReferenceField(BaseField):
value = instance._data.get(self.name)
# Dereference DBRefs
if isinstance(value, DBRef):
if self._auto_dereference and isinstance(value, DBRef):
value = self.document_type._get_db().dereference(value)
if value is not None:
instance._data[self.name] = self.document_type._from_son(value)