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
When I use diff_against between these two records, the returned ModelDelta has an empty changes list.
To Reproduce
In [21]: person=Person.objects.create(name="Eric")
In [22]: person_pk=person.idIn [23]: person.delete()
Out[23]: (1, {'data.Person': 1})
In [24]: records=HistoricalPerson.objects.filter(id=person_pk)
In [25]: recordsOut[25]: <QuerySet [<HistoricalPerson: Personobject (4) asof2024-02-1421:13:19.406277+00:00>, <HistoricalPerson: Personobject (4) asof2024-02-1421:13:02.534529+00:00>]>In [26]: delta=records[0].diff_against(records[1])
In [27]: delta.__dict__Out[27]:
{'changes': [],
'changed_fields': [],
'old_record': <HistoricalPerson: Personobject (4) asof2024-02-1421:13:02.534529+00:00>,
'new_record': <HistoricalPerson: Personobject (4) asof2024-02-1421:13:19.406277+00:00>}
In [28]: delta.new_record.history_typeOut[28]: '-'
Expected behavior
I expect to see that all values have changed to None because the record no longer exists.
Environment (please complete the following information):
OS: MacOS Sonoma 14.2.1
Browser (if applicable): Chrome
Django Simple History Version: 3.4.0
Django Version: 5.0.2
Database Version: Postgres 13
Additional context
After reading the diff_against implementation, it appears like history_type is not considered. Instead, changes are computed by checking field value differences:
Describe the bug
I am comparing two records:
When I use
diff_against
between these two records, the returnedModelDelta
has an emptychanges
list.To Reproduce
Expected behavior
I expect to see that all values have changed to
None
because the record no longer exists.Environment (please complete the following information):
Additional context
After reading the
diff_against
implementation, it appears likehistory_type
is not considered. Instead,changes
are computed by checking field value differences:The text was updated successfully, but these errors were encountered: