You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem Statement Model.objects.update_or_create will always result in a .save() call which means there will always be a new historical record created regardless if there were any changes.
Describe the solution you'd like
There could be a method similar to update_or_create that inspects the updating defaults for changes from the fetched instance. Only if there are actual changes would it make a call to .save().
Problem Statement
Model.objects.update_or_create
will always result in a.save()
call which means there will always be a new historical record created regardless if there were any changes.Describe the solution you'd like
There could be a method similar to
update_or_create
that inspects the updating defaults for changes from the fetched instance. Only if there are actual changes would it make a call to.save()
.I have a proposed method here: https://gist.github.com/tim-schilling/b04846542927f6e6be777612e4b89d57
Describe alternatives you've considered
None
Additional context
This would not be compatible with someone who is using
DateTimeField(auto_now=True)
as a heartbeat field.The text was updated successfully, but these errors were encountered: