#32406: Allow QuerySet.update() to return fields on supported backends.
-------------------------------------+-------------------------------------
Reporter: Tom Carrick | Owner: Aivars
| KalvÄns
Type: New feature | Status: assigned
Component: Database layer | Version: dev
(models, ORM) |
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Simon Charette):
* cc: Simon Charette (added)
Comment:
Before thinking about making a signature change to `Model.save` I think we
should focus on adding `QuerySet._update` support for `returning_fields`.
The reason why I think that is that defaulting to having generated fields
and model fields that are assigned expressions to be returned from the
resulting `INSERT` or `UPDATE` issues by `save()` seems like a first good
step in this direction (#27222).
Today these fields are left unchanged because
[https://github.com/django/django/blob/08dae5bd46a02a2e2798028c83d97b1894beffb8/django/db/models/base.py#L1122-L1125
we don't introspect the assigned values when calling on insert] (we
default to returning generated fields only) but since the update machinery
doesn't support returning fields
[https://github.com/django/django/blob/08dae5bd46a02a2e2798028c83d97b1894beffb8/django/db/models/base.py#L1157
we can't even return generated fields].
I feel like we shouldn't get ahead our ourselves here and start by fixing
#27222 for insert and updates and then see if there are cases where
specifying a subset of returned fields on save is worth adding.
--
Ticket URL: <https://code.djangoproject.com/ticket/32406#comment:22>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/django-updates/01070195ac984eb1-2d86af15-8fd8-4975-934f-e795dc1a7d57-000000%40eu-central-1.amazonses.com.