Suggested fix for #1047: CachedReferenceField creates DBRef on to_python, but can't save them on to_mongo.
Dereferencing DBRef to document type before returning it from to_python.
This commit is contained in:
parent
1e930fe950
commit
9ce605221a
@ -1034,6 +1034,7 @@ class CachedReferenceField(BaseField):
|
|||||||
collection = self.document_type._get_collection_name()
|
collection = self.document_type._get_collection_name()
|
||||||
value = DBRef(
|
value = DBRef(
|
||||||
collection, self.document_type.id.to_python(value['_id']))
|
collection, self.document_type.id.to_python(value['_id']))
|
||||||
|
return self.document_type._from_son(self.document_type._get_db().dereference(value))
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user