diff --git a/docs/changelog.rst b/docs/changelog.rst index 334b1a24..6820368c 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -4,6 +4,7 @@ Changelog Changes in 0.8.5 ================ +- Fix testing invalid dict field value (#485) - Added app_label to MongoUser (#484) - Use defaults when host and port are passed as None (#483) - Fixed distinct casting issue with ListField of EmbeddedDocuments (#470) diff --git a/mongoengine/base/fields.py b/mongoengine/base/fields.py index c6abd02b..752dc631 100644 --- a/mongoengine/base/fields.py +++ b/mongoengine/base/fields.py @@ -203,7 +203,7 @@ class ComplexBaseField(BaseField): _dereference = _import_class("DeReference")() self._auto_dereference = instance._fields[self.name]._auto_dereference - if instance._initialised and dereference: + if instance._initialised and dereference and instance._data.get(self.name): instance._data[self.name] = _dereference( instance._data.get(self.name), max_depth=1, instance=instance, name=self.name