Allow nested fields as model instances in __init__ method (bugfix? e.g. MyModel(nested=MyNested()))
Allow update/merge with None in a deeply nested field (bugfix?)
Wrap errors to add field path to the error message (e.g.: ... "a.b[0].c.d": field is required). Most likely, it will not break backward compatibility because there wasn't a base exception class, so most likely no one used particle exception in except statement
Set Meta.ignore_none_field=False by default. Most likely, it will not brake back-compatibility because True value was used to hide bugs in update. But... I think we can ignore None on create but not on update 🤔. It is not really clear how it should work. It probably should be "ignore default None, but save if it was set manually"
Refactor some related code:
Add base exception class for model exceptions
Remove unused code
Remove conditions used to hide/resolve bugs for some cases
Move all the serialization/deserialization logic to Model. So, now there is only one place for it, which allows handling nested fields in a more convenient way, and overrides this behavior in NeatedModelField.get_value method.
Do I have a chance to have this merged, or is it too big one? Not sure how to do it in smaller PRs btw.
I would like to use this code in a project I'm currently working on. So, I'll test it on real data as soon I'll know I have a chance to have it merged :)
[{a: {b: [{c: {d: 'e'}}]}}]
)__init__
method (bugfix? e.g.MyModel(nested=MyNested())
)... "a.b[0].c.d": field is required
). Most likely, it will not break backward compatibility because there wasn't a base exception class, so most likely no one used particle exception inexcept
statementTrue
value was used to hide bugs inupdate
. But... I think we can ignoreNone
on create but not onupdate
🤔. It is not really clear how it should work. It probably should be "ignore default None, but save if it was set manually"Model
. So, now there is only one place for it, which allows handling nested fields in a more convenient way, and overrides this behavior inNeatedModelField.get_value
method.Do I have a chance to have this merged, or is it too big one? Not sure how to do it in smaller PRs btw. I would like to use this code in a project I'm currently working on. So, I'll test it on real data as soon I'll know I have a chance to have it merged :)