-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
create historical instance with respect to using() for multidb enviro… #507
Conversation
Codecov Report
@@ Coverage Diff @@
## master #507 +/- ##
=======================================
Coverage 97.74% 97.74%
=======================================
Files 17 17
Lines 799 799
Branches 111 111
=======================================
Hits 781 781
Misses 8 8
Partials 10 10
Continue to review full report at Codecov.
|
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.
Looks good to me. @ThePumpingLemma @barm @kseever want to give it another look through? Thanks for this @erikvw !
@erikvw waiting on another review here and then I'll merge. Out of curiosity, does your |
@erikvw looking at this in the context of #539 and I think we made a mistake. It seems that |
Modify so historical record works in a multi-database setup by respecting Django's queryset chained method
using()
and theusing
keyword argument ofsave()
anddelete()
.Description
In a multi-database environment, historical instances should be created in the same DB as the parent model instance. Currently this is not the case.
For example, if
settings
defines multiple databases:... the following code will create historical records in database
default
regardless of the value passed tousing()
:... the same incorrect behavior is seen with
save()
anddelete()
:Related Issue
Motivation and Context
We use this module in a multi-database environment and detected this problem.
How Has This Been Tested?
Tests have been added to
test_models.py
Screenshots (if appropriate):
Types of changes
Checklist:
make format
command to format my codeAUTHORS.rst
CHANGES.rst