Merge pull request #1916 from liuq/master

Bug fix: pre_save_post_validation could, in principle, modify the document
This commit is contained in:
erdenezul
2018-10-10 17:12:39 +08:00
committed by GitHub

View File

@@ -368,6 +368,8 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
signals.pre_save_post_validation.send(self.__class__, document=self,
created=created, **signal_kwargs)
# it might be refreshed by the pre_save_post_validation hook, e.g., for etag generation
doc = self.to_mongo()
if self._meta.get('auto_create_index', True):
self.ensure_indexes()