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
Fixed #28344 -- Allowed customizing queryset in Model.refresh_from_db()/arefresh_from_db(). #17592
Conversation
f0d2ef8
to
3790398
Compare
3790398
to
0d71781
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.
@aivarsk Thanks for this patch 👍 I left initial comments.
6fdb0f6
to
d01b2ad
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.
Thank you for committing to this patch @aivarsk, this is looking great!
I don't have anything to add really, the fact select_related
is also tested and that the documentation includes examples of how it can be relied on to exclude rows and lock them. Seing the patch completed reinforces my believe that this is going to be useful for more than just row locking like it was intentionally intended.
Approving assuming the release note message is adjusted.
…()/arefresh_from_db(). The from_queryset parameter can be used to: - use a custom Manager - lock the row until the end of transaction - select additional related objects
@aivarsk Thanks for this patch 👍 Welcome aboard ⛵ I added support for |
The from_queryset parameter can be used to:
from_queryset=Model.active_objects.all()
from_queryset=Model.objects.select_for_update()
from_queryset=Model.objects.select_related('related_field')