Created
November 22, 2019 06:44
-
-
Save sanjaykrishnan/62af8c5a983b55aac0fac9d1cf618f97 to your computer and use it in GitHub Desktop.
Django Simple History, track all changes for this object.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
p = "Object for which change is to be " | |
for i in p.history.all(): | |
previous = i.prev_record | |
if previous: | |
delta = i.diff_against(previous) | |
for change in delta.changes: | |
print("{} user changed {} from {} to {}".format(i.history_user, change.field, change.old, change.new)) | |
else: | |
print("{} created this item") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment