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
We've run in to the situation a few times where multiple .save()s need to be called in short succession / a single "change" and it would be convenient to be able to specify that these multiple saves should be recorded as a single history record.
We run into this same problem when tracking m2m changes too since those changes set off a signal that trigger creation of additional history records ( I think there's discussion about this in #399 )
Describe the solution you'd like
A few potential interfaces:
something like skip_history_when_saving but append_history_when_saving or similar
For all of these ways to go about this, what they would functionally do is just delete earlier records & potentially copy over date/user/change reason information.
One unanswered question is how multiple change reasons / change users on a record would work. Probably just have to arbitrarily choose to keep one (I would prefer to keep the change reason on the earliest history record)
Describe alternatives you've considered
Theoretically a workaround is temporarily not recording history then doing a final .save() with history recording enabled, or deleting each created record on a new .save(), or appending changes to an existing history record with .latest(). I'de just like to formalize a mechanism to do this & not have to reinvent ways to achieve this every time.
The text was updated successfully, but these errors were encountered:
Problem Statement
We've run in to the situation a few times where multiple
.save()
s need to be called in short succession / a single "change" and it would be convenient to be able to specify that these multiple saves should be recorded as a single history record.We run into this same problem when tracking m2m changes too since those changes set off a signal that trigger creation of additional history records ( I think there's discussion about this in #399 )
Describe the solution you'd like
A few potential interfaces:
skip_history_when_saving
butappend_history_when_saving
or similarHistoryRecord.merge_with_previous()
/HistoryRecord.merge_into_and_delete(record)
.history.merge_till(record)
For all of these ways to go about this, what they would functionally do is just delete earlier records & potentially copy over date/user/change reason information.
One unanswered question is how multiple change reasons / change users on a record would work. Probably just have to arbitrarily choose to keep one (I would prefer to keep the change reason on the earliest history record)
Describe alternatives you've considered
Theoretically a workaround is temporarily not recording history then doing a final
.save()
with history recording enabled, or deleting each created record on a new.save()
, or appending changes to an existing history record with.latest()
. I'de just like to formalize a mechanism to do this & not have to reinvent ways to achieve this every time.The text was updated successfully, but these errors were encountered: