Open afsangujarati93 opened 4 weeks ago
I agree with you. The logic behind the design is to execute the submit-line actions after the object is saved, along with which one implication is that all the relations should also be saved as well.
@afsangujarati93 would you mind to prepare a PR with an appropriate test? Definitely this is something what can be merged.
I have a Django change form with a few inlines. I have created a actions_submit_line action that basically updates the
status
field in the model object and sends an email. The email is generated using the content from both parent and inline/child model fields. However, the email is missing the fields from the child model.On further digging into the unfold repo, I noticed that the actions are called from the
save_model
function and as per the django's core implementationsave_related
is called after thesave_model
which explains why the related model fields are not present/saved when the email is sent.Currently I am overriding the
save_model
andsave_related
in my modeladmin to workaround this issue.Should this be part of the unfold's core functionality, if not, what's the argument against it?