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
commit 45c86be402
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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()