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
Get an instance from history using as_instances() and try to access .poll
choice.history.as_instances().first().poll # raises error
choice.history.first().instance.poll # works
I did notice that choice.history.first().instance has no attribute _history._as_of but choice.history.as_instances().first() has _history._as_of == None. I think this causes HistoryManager.as_of to be called with date=None.
Expected behavior
Accessing related object works after using .as_instances().
Environment (please complete the following information):
OS: Linux Mint 21.2
Django Simple History Version: 3.4.0
Django Version: 4.2.6
Database Version: sqlite3
The text was updated successfully, but these errors were encountered:
Describe the bug
According to the documentation, these two should be equivalent
but if you use
.as_instances()
and try to access an object related through a HistoricForeignKey, an error is thrown:The stack trace points to
manager.py, line 202, in as_of
:To Reproduce
Steps to reproduce the behavior:
as_instances()
and try to access.poll
I did notice that
choice.history.first().instance
has no attribute_history._as_of
butchoice.history.as_instances().first()
has_history._as_of == None
. I think this causesHistoryManager.as_of
to be called withdate=None
.Expected behavior
Accessing related object works after using
.as_instances()
.Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: