Closed ADR-007 closed 1 year ago
The update method doesn't work correctly with a nested model.
from fireo.fields import NestedModel, TextField from fireo.models import Model class MyNestedModel(Model): my_nested_field = TextField() class MyModel(Model): my_field = TextField() my_nested_model = NestedModel(MyNestedModel) def test_update(): model = MyModel( my_field='my_field', my_nested_model=dict(my_nested_field='my_nested_field') ) model.save() model_from_db = MyModel.collection.get(model.key) # this works assert model_from_db.my_field == 'my_field' assert model_from_db.my_nested_model.my_nested_field == 'my_nested_field' MyModel(my_field='new value').update(model.key) model_from_db = MyModel.collection.get(model.key) assert model_from_db.my_field == 'new value' assert model_from_db.my_nested_model.my_nested_field == 'my_nested_field' # Expected: 'my_nested_field' # Actual: None
Fixed here
The update method doesn't work correctly with a nested model.