Skip to content

Is there a way to only update certain fields in update()? #141

Answered by collerek
aliakhtar asked this question in Q&A
Discussion options

You must be logged in to vote

Yeah, it's a clear omission.
In bulk_update you have columns: List to set columns that should be updated.
In QuerySet.update (so Model.objects.update(**kwargs)) you only update params passed as kwargs.

And in 0.10.2 (PR #140) that will be merged this week I added _columns: List[str] to Model.update() where you can pass fields that should be updated (if omitted or empty all fields are updated)

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@aliakhtar
Comment options

Answer selected by aliakhtar
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants