--
Ticket URL: <https://code.djangoproject.com/ticket/35014>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
* component: Uncategorized => Database layer (models, ORM)
* type: Uncategorized => Cleanup/optimization
Comment:
This is an intentional change mentioned in
[https://docs.djangoproject.com/en/stable/releases/4.2/#setting-update-
fields-in-model-save-may-now-be-required release notes].
> That means developer's could count on the model save method being run
and all fields being updated regardless of the defaults argument.
I'm not sure how you use this. Are you talking about database triggers
with some sophisticated behavior? If yes, then you can always pass all
fields in `update_fields` or use triggers on rows (not particular column)
update. I don't think it's worth additional complexity in Django itself.
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:1>
Comment (by Jordan Hyatt):
I just thought it would be nice and simple to add a
"pass_update_fields=True" to update_or_create so that you can bypass the
new behavior implemented that can have a huge effect on previously written
code. You are right about catching the update_fields in the save, but
there is no way to know if the save was called by update_or_create or not.
What if sometimes I do want the update_fields to be used as is, just not
when update_or_create was the source?
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:2>
Comment (by Jordan Hyatt):
Also, in general, I don't think its a bad idea to have a little control
over the way that update_or_create calls the save method. It's not overly
complicated to give a little flexibility in that regard
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:3>
* Attachment "update_or_create.PNG" added.
Suggested Changes
--
Ticket URL: <https://code.djangoproject.com/ticket/35014>
* status: closed => new
* resolution: wontfix =>
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:4>
* status: new => closed
* resolution: => wontfix
Comment:
I appreciate you'd like to reopen the ticket, but please
[https://docs.djangoproject.com/en/stable/internals/contributing/triaging-
tickets/#closing-tickets follow the triaging guidelines with regards to
wontfix tickets] and take this to DevelopersMailingList (or
[https://forum.djangoproject.com/ Django Forum]) , where you'll reach a
wider audience and see what other think.
> But wouldn't it be kind of neat if update_or_create could pass along
additional kwargs to your custom save method?
We don't add new options if it's not something useful for many folks.
> I know I have plenty of use cases for that.
You didn't not present any specifics. Please be prepared to share concrete
example in a forum/mailing list thread, if you will decide to start a
discussion.
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:5>
Comment (by Jordan Hyatt):
I have opened a forum topic where I posted a concrete use case.
https://forum.djangoproject.com/t/update-or-create-behavior/25944
--
Ticket URL: <https://code.djangoproject.com/ticket/35014#comment:6>