Opened 9 years ago

Closed 9 years ago

#5417 closed (duplicate)

Add a way to update multiple records at once

Reported by: adrian Owned by: nobody
Component: Database layer (models, ORM) Version: master
Severity: Keywords: feature_request, qs-rf
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: no
Easy pickings: UI/UX:


The Django ORM currently doesn't allow for the update of multiple records in a single statement. We can add this feature in a pretty clean and consistent way by adding a QuerySet.update() method:

# UPDATE place SET city='Chicago' WHERE city='chicago';

# UPDATE contestant SET age=age+2 WHERE answer='1';

The second example introduces SqlClause, which would be a way of specifying clauses instead of hard-coded values. We could potentially begin using this SqlClause in other places, too.

Attachments (1)

mult_update_partial.diff (1.0 KB) - added by deepak <deep.thukral@…> 9 years ago.
need testing doing part1

Download all attachments as: .zip

Change History (5)

comment:1 Changed 9 years ago by PhiR

  • Keywords feature_request added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 9 years ago by Simon G. <dev@…>

  • Keywords qs-rf added
  • Triage Stage changed from Unreviewed to Accepted

Changed 9 years ago by deepak <deep.thukral@…>

need testing doing part1

comment:3 Changed 9 years ago by deepak <deep.thukral@…>

  • Has patch set
  • Needs tests set

Sorry, I was working on it before qs-rf tag, so I just added where i was till then. Its partial patch(covers example 1) and needs testing.

comment:4 Changed 9 years ago by ubernostrum

  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #4260.

Note: See TracTickets for help on using tickets.
Back to Top