#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: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by Aivars Kalvāns): Yes I saw it. But I did not see there a way to implement the new behavior without breaking the API. Is there something I missed? Returning a tuple with {{{(n, [data])}}} will break the code that expects a simple integer, making the {{{returning}}} kwarg special also can break something (but unlikely) and chaining of method calls like {{{.update().value()}}} is not possible because the update is expected to execute the SQL before returning. So asides from naming the function I think that returning models by default is nice because it includes PK and the result is "usable". If you don't need the models, you can ask for values or values_list. There are people using {{{QuerySet.raw()}}} to achieve similar result (https://hakibenita.com/django-concurrency#update-and-immediately-return) -- Ticket URL: <https://code.djangoproject.com/ticket/32406#comment:16> 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 django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/0107018acbf58fa4-f760ccfe-c7b8-45fd-b816-10e092951dfd-000000%40eu-central-1.amazonses.com.