Skip to content

Commit

Permalink
Merge f77f45b into 103a287
Browse files Browse the repository at this point in the history
  • Loading branch information
elephanter committed Apr 9, 2015
2 parents 103a287 + f77f45b commit 6762a4d
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -219,3 +219,4 @@ that much better:
* Jimmy Shen (https://github.com/jimmyshen)
* J. Fernando Sánchez (https://github.com/balkian)
* Michael Chase (https://github.com/rxsegrxup)
* Eremeev Danil (https://github.com/elephanter)
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ Changes in 0.9.0
- Fixed a few instances where reverse_delete_rule was written as reverse_delete_rules. #791
- Make `in_bulk()` respect `no_dereference()` #775
- Handle None from model __str__; Fixes #753 #754
- _get_changed_fields fix for embedded documents with id field. #925

Changes in 0.8.7
================
Expand Down
3 changes: 1 addition & 2 deletions mongoengine/base/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ def to_mongo(self, use_db_field=True, fields=None):
"""
if not fields:
fields = []

data = SON()
data["_id"] = None
data['_cls'] = self._class_name
Expand Down Expand Up @@ -553,7 +553,6 @@ def _get_changed_fields(self, inspected=None):
if hasattr(data, 'id'):
if data.id in inspected:
continue
inspected.add(data.id)
if isinstance(field, ReferenceField):
continue
elif (isinstance(data, (EmbeddedDocument, DynamicEmbeddedDocument))
Expand Down
3 changes: 3 additions & 0 deletions tests/document/delta.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_delta_recursive(self):
def delta_recursive(self, DocClass, EmbeddedClass):

class Embedded(EmbeddedClass):
id = StringField()
string_field = StringField()
int_field = IntField()
dict_field = DictField()
Expand All @@ -114,6 +115,7 @@ class Doc(DocClass):
self.assertEqual(doc._delta(), ({}, {}))

embedded_1 = Embedded()
embedded_1.id = "010101"
embedded_1.string_field = 'hello'
embedded_1.int_field = 1
embedded_1.dict_field = {'hello': 'world'}
Expand All @@ -123,6 +125,7 @@ class Doc(DocClass):
self.assertEqual(doc._get_changed_fields(), ['embedded_field'])

embedded_delta = {
'id': "010101",
'string_field': 'hello',
'int_field': 1,
'dict_field': {'hello': 'world'},
Expand Down

0 comments on commit 6762a4d

Please sign in to comment.