-
-
Notifications
You must be signed in to change notification settings - Fork 480
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
Add bulk_update_with_history #650
Conversation
Using Django 2.2's bulk_update feature. This is significantly simpler than bulk_create_with_history because we don't have to worry about the primary key issue.
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.
This looks good to me! Thanks for doing this. Want to add docs and tests? I would go off of the tests for bulk_create_with_history
for reference on how to test this
Also, since the codebase still technically supports Django 1.11, 2.0, and 2.1, just have the tests skip if the django version is any of those. I'm going to remove support for them before the next release. |
@rossmechanic ready for review. I use |
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.
@jihoon796 looks good! Just make the changes to the docs. Also please update the CHANGEs.rst
file with
Unreleased
------------
- Added `bulk_update_with_history` utility function (gh-650)
Will approve and merge once that's done. Thanks!
docs/common_issues.rst
Outdated
@@ -42,8 +42,28 @@ can add `changeReason` on each instance: | |||
>>> Poll.history.get(id=data[0].id).history_change_reason | |||
'reason' | |||
|
|||
Bulk Updating a Model with History (New) | |||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
@jihoon796 also, I just looked at the travis build https://travis-ci.org/github/treyhunner/django-simple-history. Looks like you need to run |
@rossmechanic updated the docs as requested and ran |
https://travis-ci.org/github/treyhunner/django-simple-history/jobs/679104605 |
@rossmechanic got it - fixed the trailing whitespace error, so it should pass all checks now. When is the next planned release? Would love to use it as soon as possible. |
Cool. Looks like it's passing everything. I wasn't planning to do a release for another month (and get some changes in before doing a 3.0 release), which is why I said don't worry about backward compatibility. However, if you want to update this PR so that it's still compatible with django versions 1.11, 2.0 and 2.1, then I'd be happy to get this PR and #636 merged and released this weekend. The other options is to pip install this merge commit directly. What do you want to do? |
for reference, to make this backward compatible you just need to do the following within your
|
Codecov Report
@@ Coverage Diff @@
## master #650 +/- ##
==========================================
- Coverage 97.70% 97.08% -0.63%
==========================================
Files 17 17
Lines 914 925 +11
Branches 136 138 +2
==========================================
+ Hits 893 898 +5
- Misses 9 15 +6
Partials 12 12
Continue to review full report at Codecov.
|
@rossmechanic Would be great to get the release out as early as possible. I've updated this PR (added your snippet) so that it's still compatible with Django versions 1.11, 2.0 and 2.1. Ran the same tests as earlier as well and everything looks good. Also - thanks for the quick feedback! |
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.
Thanks @jihoon796 ! I think I should update #635 and get it merged, but I'll release as soon as that is done
I have yet to add tests or documentation. Once a maintainer gives the green light, I'll finish writing all of the documentation, although I will need help writing tests.
Description
Added
bulk_update_with_history
, using Django 2.2'sbulk_update
feature.Related Issue
#528
Motivation and Context
#528
Types of changes
Checklist:
make format
command to format my codeAUTHORS.rst
CHANGES.rst