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 needed to implement a timeline considering the changes made in a specific model. For that, we basically needed the "difference" between two records.
In order to do that, we created a __sub__ method that allowed us to simply do something like this: history[1] - history[0].
The result of this operation is an instance of a class called ModelDelta, that gives us the following information:
the new value
the old value
the fields that changed in the process
user that made the change (to the new value)
On this ModelDelta class we implemented a function to_timeline that get every changed field and apply a function to create a timeline entry with some messages like This user changed this fields at this hour.
I would like to know if you would think this is interesting to be a feature in the project, and if you have suggestion for better approach.
The text was updated successfully, but these errors were encountered:
@leportella Yes! I would love to see this going as a django admin view. There is an old PR #103 that adds a history compare view. Maybe we can combine the 2? Happy to help!
We needed to implement a timeline considering the changes made in a specific model. For that, we basically needed the "difference" between two records.
In order to do that, we created a
__sub__
method that allowed us to simply do something like this:history[1] - history[0]
.The result of this operation is an instance of a class called ModelDelta, that gives us the following information:
On this ModelDelta class we implemented a function
to_timeline
that get every changed field and apply a function to create a timeline entry with some messages likeThis user changed this fields at this hour
.I would like to know if you would think this is interesting to be a feature in the project, and if you have suggestion for better approach.
The text was updated successfully, but these errors were encountered: