Merge pull request #2082 from divomen/v0.18.0_fix

Fix a big issue when determine if there is a new document
This commit is contained in:
Bastien Gérard
2019-06-17 22:30:18 +02:00
committed by GitHub
2 changed files with 60 additions and 19 deletions

View File

@@ -371,7 +371,7 @@ class Document(six.with_metaclass(TopLevelDocumentMetaclass, BaseDocument)):
if write_concern is None:
write_concern = {}
doc_id = self.to_mongo(fields=['id'])
doc_id = self.to_mongo(fields=[self._meta['id_field']])
created = ('_id' not in doc_id or self._created or force_insert)
signals.pre_save_post_validation.send(self.__class__, document=self,