since they can no longer rely on save methods that automatically update derived fields to get saved because they wont be listed in update_fields.
Aren’t such derived fields broken by design for any usage of Model.save(update_fields)
?
Why can’t the save
method of such models be adapted to augment update_fields
with the dependant fields instead?
def save(self, **options):
if update_fields := options.get("update_fields"):
options["update_fields"] = (
set(update_fields)
| self.get_derived_fields(update_fields)
)
return super().save(**options)
While I’m not convinced of its necessity I understand the reason why you’d want a use_update_fields
flag to disable this new behaviour under some circumstances.
As for the extra_save_kwargs
part of your proposed solution it has nothing do to with the problem discussed here. Django cannot support passing application specific flags to methods this way through a public interface.