_get_changed_fields fix for embedded documents with id field.
removed commented out piece of code added author and record to changelog
This commit is contained in:
parent
103a287f11
commit
f77f45b70c
1
AUTHORS
1
AUTHORS
@ -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)
|
||||
|
@ -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
|
||||
================
|
||||
|
@ -308,7 +308,7 @@ class BaseDocument(object):
|
||||
"""
|
||||
if not fields:
|
||||
fields = []
|
||||
|
||||
|
||||
data = SON()
|
||||
data["_id"] = None
|
||||
data['_cls'] = self._class_name
|
||||
@ -553,7 +553,6 @@ class BaseDocument(object):
|
||||
if hasattr(data, 'id'):
|
||||
if data.id in inspected:
|
||||
continue
|
||||
inspected.add(data.id)
|
||||
if isinstance(field, ReferenceField):
|
||||
continue
|
||||
elif (isinstance(data, (EmbeddedDocument, DynamicEmbeddedDocument))
|
||||
|
@ -93,6 +93,7 @@ class DeltaTest(unittest.TestCase):
|
||||
def delta_recursive(self, DocClass, EmbeddedClass):
|
||||
|
||||
class Embedded(EmbeddedClass):
|
||||
id = StringField()
|
||||
string_field = StringField()
|
||||
int_field = IntField()
|
||||
dict_field = DictField()
|
||||
@ -114,6 +115,7 @@ class DeltaTest(unittest.TestCase):
|
||||
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'}
|
||||
@ -123,6 +125,7 @@ class DeltaTest(unittest.TestCase):
|
||||
self.assertEqual(doc._get_changed_fields(), ['embedded_field'])
|
||||
|
||||
embedded_delta = {
|
||||
'id': "010101",
|
||||
'string_field': 'hello',
|
||||
'int_field': 1,
|
||||
'dict_field': {'hello': 'world'},
|
||||
|
Loading…
x
Reference in New Issue
Block a user