-
Notifications
You must be signed in to change notification settings - Fork 494
Support changeReason for bulk history create #449
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
Conversation
CHANGES.rst
Outdated
| ---------- | ||
| - Add ability to cascade delete historical records when master record is deleted | ||
| - Add ability to cascade delete historical records when master record is deleted | ||
| - Add `'+'` as the `history_type` for each instance in `bulk_history_create` |
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 add this PR number next to the change please. i.e. (gh-449)
docs/reference.rst
Outdated
| >>> for poll in data: | ||
| poll.changeReason = 'reason' | ||
| >>> objs = bulk_create_with_history(data, Poll, batch_size=500) | ||
| >>> Poll.objects.get(id=data[0].id).history_change_reason |
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.
Wouldn't this have to be HistoricalPoll or Poll.history.get? I don't think there's a history_change_reason on the base instance
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.
@rossmechanic , yeah you are right.
| self.model( | ||
| history_date=getattr(instance, '_history_date', now()), | ||
| history_user=getattr(instance, '_history_user', None), | ||
| history_change_reason=getattr(instance, 'changeReason', ''), |
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.
👍
|
Tests failed, which is why #447 will be awesome. Just a few questions around documentation of changeReason but overall lgtm |
Codecov Report
@@ Coverage Diff @@
## master #449 +/- ##
=======================================
Coverage 97.34% 97.34%
=======================================
Files 15 15
Lines 679 679
Branches 93 93
=======================================
Hits 661 661
Misses 9 9
Partials 9 9Continue to review full report at Codecov.
|
barm
left a comment
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
rossmechanic
left a comment
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
Description
'+'as thehistory_typefor each instance inbulk_history_createhistory_change_reasonfor each instance inbulk_history_createRelated Issue
#442
Motivation and Context
This solves issue #442
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: