Fix for bug where changes to a a embedded document field are not recorded if the root document was just created+saved.

This commit is contained in:
Robert Kajic
2012-03-02 11:15:31 +01:00
parent 32fc4152a7
commit c272b7901f
3 changed files with 40 additions and 6 deletions

View File

@@ -335,14 +335,16 @@ class DynamicDocTest(unittest.TestCase):
self.assertEquals(doc._get_changed_fields(), ['embedded_field'])
embedded_delta = {
'_types': ['Embedded'],
'_cls': 'Embedded',
'string_field': 'hello',
'int_field': 1,
'dict_field': {'hello': 'world'},
'list_field': ['1', 2, {'hello': 'world'}]
}
self.assertEquals(doc.embedded_field._delta(), (embedded_delta, {}))
embedded_delta.update({
'_types': ['Embedded'],
'_cls': 'Embedded',
})
self.assertEquals(doc._delta(), ({'embedded_field': embedded_delta}, {}))
doc.save()