-
-
Notifications
You must be signed in to change notification settings - Fork 485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
'as_of' for models #106
'as_of' for models #106
Conversation
""" | ||
as_of_list = list( | ||
self.model.history.as_of(self.now - timedelta(days=1))) | ||
self.assertEqual(as_of_list[0].changed_by, self.obj.changed_by) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these tests seem to check for only one instance. Should we test that multiple objects can be returned?
I made some comments about more test ideas. This looks ready to merge to me. Feel free to merge now or add some more tests and then merge. |
return history_obj.instance | ||
|
||
def _as_of_set(self, date): | ||
model = type(self.model().instance) # a bit of a hack to get the model |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@treyhunner, do you know of a better way of getting at the original model?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I do not.
Extend the 'as_of' method to work as a class method
Modifies 'as_of' on the historical manager to return an iterable when no instance is provided.
See discussion in #53