fix LazyReferenceField dereferencing bug in embedded documents, refs #2375

This commit is contained in:
Peter Volf
2020-11-25 11:05:37 +01:00
parent 904fcd1a0a
commit cc5e2ba054
2 changed files with 46 additions and 0 deletions

View File

@@ -2570,6 +2570,7 @@ class LazyReferenceField(BaseField):
if not isinstance(value, (DBRef, Document, EmbeddedDocument)):
collection = self.document_type._get_collection_name()
value = DBRef(collection, self.document_type.id.to_python(value))
value = self.build_lazyref(value)
return value
def validate(self, value):