-
-
Notifications
You must be signed in to change notification settings - Fork 464
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
feat: add default_date optional parameter for bulk create and update #687
Conversation
a0bf928
to
ee7424d
Compare
Hi @sbor23 not sure what happened with the hooks for travis. Can you try repushing this so I can see tests? |
ee7424d
to
2ff83c8
Compare
Sure, did that :) |
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.
just one change otherwise looks good to me
simple_history/manager.py
Outdated
history_date=default_date | ||
or getattr(instance, "_history_date", timezone.now()), |
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.
Would prefer that this follow the pattern of _history_user
, such that _history_date
takes precedence over default_date
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.
Ah true, _history_date
gives more fine-grained control so it should take precedence. Haven't really used it yet. :)
2ff83c8
to
ace6334
Compare
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.
LGTM! Thanks @sbor23
Add default_date parameter for bulk creating and updating historical entries.
Description
This change adds a keyword argument
default_date
to thebulk_history_create()
method on theHistoryManager
, as well as the utility functionsbulk_create_with_history()
andbulk_update_with_history()
.If provided, the created or updated history entries will have the field
history_date
set to this date.Related Issue
#686
Motivation and Context
It provides an easy way to set the history_date when dealing with bulk operations.
How Has This Been Tested?
Unittests have been added.
Types of changes
Checklist:
make format
command to format my codeAUTHORS.rst
CHANGES.rst