diff --git a/AUTHORS b/AUTHORS index 7c2f8c83..aa7f833d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -134,4 +134,5 @@ that much better: * Martyn Smith * Marcelo Anton * Aleksey Porfirov - * Nicolas Trippar \ No newline at end of file + * Nicolas Trippar + * Manuel Hermann \ No newline at end of file diff --git a/docs/changelog.rst b/docs/changelog.rst index 3e8f7821..1905a9d3 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -28,6 +28,7 @@ Changes in 0.8.X - FileFields now copyable (#198) - Querysets now return clones and are no longer edit in place (#56) - Added support for $maxDistance (#179) +- Uses getlasterror to test created on updated saves (#163) Changes in 0.7.9 ================ diff --git a/mongoengine/document.py b/mongoengine/document.py index 03a838bf..69d4d406 100644 --- a/mongoengine/document.py +++ b/mongoengine/document.py @@ -219,11 +219,11 @@ class Document(BaseDocument): doc = self.to_mongo() - find_delta = ('_id' not in doc or self._created or force_insert) + created = ('_id' not in doc or self._created or force_insert) try: collection = self.__class__.objects._collection - if find_delta: + if created: if force_insert: object_id = collection.insert(doc, safe=safe, **write_options) @@ -289,8 +289,7 @@ class Document(BaseDocument): self._changed_fields = [] self._created = False - signals.post_save.send(self.__class__, document=self, - created=find_delta) + signals.post_save.send(self.__class__, document=self, created=created) return self def cascade_save(self, warn_cascade=None, *args, **kwargs):