-
-
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
Batch with additional historical model fields #1248
Conversation
I wanted to note a few things about this I can not get the documents to generate on my machine or run the Maybe I did not add the pydoc to the function which had the signatures changed let me know if this looks like something you'd go forward with and I'll make changes |
Codecov Report
@@ Coverage Diff @@
## master #1248 +/- ##
=======================================
Coverage 96.94% 96.94%
=======================================
Files 23 23
Lines 1275 1277 +2
Branches 209 210 +1
=======================================
+ Hits 1236 1238 +2
Misses 21 21
Partials 18 18
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
I wouldn't worry about this, as the docs are built through the CI anyway 🙂 (See the checks at the bottom of this page - which contain this link to the build for this PR: https://django-simple-history--1248.org.readthedocs.build/en/1248/.)
This sounds like
Yeah, I agree. The
It would be great if you could update the docstrings of
Sure, this absolutely seems useful! Thank you for taking the time 😊 |
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.
Some additional changes to the ones discussed above:
I've submitted the suggested changes. |
the failing tests on |
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.
Nice! Some feedback on the new code:
Yeah, it's caused by some recent changes in Django's |
Alright, I'll Thanks for your help |
I noticed that the |
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.
Great job, thank you! 😊
@NoelJames Lastly, before merging, would you like to rebase to clean up your commits? 🙂 Otherwise, I'll just squash them, as to me they seem to be telling one coherent story (except for 42c59aa, I guess). |
I got pretty messy there. And rebase has not been very good to me so, please squash away. |
No worries, it's just natural when working on a PR after feedback :) But alright 👌 |
* docs * add history attribute to batch * doc updates * uses `custom_historical_attrs` not kwargs * updates docs with PollWithHistoricalSessionAttr and session attr * changes example values to not be same as other examples * adds PollWithHistoricalSessionAttr for testing * updates test for PollWithHistoricalSessionAttr * adds custom_historical_attrs to test_bulk_create_no_ids_return test * corrected change list * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * updates `SessionsHistoricalModel` with explicit default=None * updates CustomHistoricalAttrsTest test to use TestCase setUp * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fixes: id value can not be 0 * Update CHANGES.rst Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update docs/common_issues.rst Co-authored-by: Anders <[email protected]> * Update docs/common_issues.rst Co-authored-by: Anders <[email protected]> * Update docs/common_issues.rst Co-authored-by: Anders <[email protected]> * Update docs/common_issues.rst Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update simple_history/tests/tests/test_utils.py Co-authored-by: Anders <[email protected]> * Update simple_history/manager.py Co-authored-by: Anders <[email protected]> * updates docstring --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Anders <[email protected]>
This fixes a "hack" for when a user only wants to provide the `custom_historical_attrs` argument, where a list with arbitrary field names could be provided as a circumvention for the error that was raised otherwise - even if no model fields were actually changed.
Description
Adds ability to update history model attributes (custom ones) during a batch job.
Related Issue
closes #1247
Motivation and Context
Adding additional fields to historical models has been a useful approach to capturing some necessary data for me. However, I also have some operations that require bulk_update_with_history and bulk_create_with_history but these functions do not support these customized field value.
How Has This Been Tested?
The pr includes tests
Types of changes
Checklist:
pre-commit run
command to format and lint.AUTHORS.rst
CHANGES.rst