We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a11f903 commit 60af03cCopy full SHA for 60af03c
simple_history/models.py
@@ -437,9 +437,13 @@ def diff_against(self, old_history):
437
438
changes = []
439
changed_fields = []
440
+ instance_fields = [field.name for field in self.instance._meta.fields]
441
+ old_instance_fields = [
442
+ field.name for field in old_history.instance._meta.fields
443
+ ]
444
for field in self._meta.fields:
- if hasattr(self.instance, field.name) and \
- hasattr(old_history.instance, field.name):
445
+ if field.name in instance_fields and \
446
+ field.name in old_instance_fields:
447
old_value = getattr(old_history, field.name, '')
448
new_value = getattr(self, field.name)
449
if old_value != new_value:
0 commit comments