Closed Bug 988857 Opened 11 years ago Closed 9 years ago

Use .save(update_fields=[...]) everywhere we can, especially in .update() calls

Categories

(Marketplace Graveyard :: Code Quality, defect, P4)

defect

Tracking

(Not tracked)

VERIFIED FIXED
2015-09-22

People

(Reporter: mat, Assigned: mat)

References

()

Details

(Whiteboard: [repoman] )

Django 1.5 introduces .save(update_fields=[...]), which lets you specify which fields end up in the UPDATE query made to the database. Without this, all fields on the model are pushed to the database, potentially overwriting existing changes (which can be very bad in some cases) and making the UPDATE query potentially huge. Once we're sure the 1.6 update is good and not going to be reverted, we should use that new parameter everywhere we can, particular in our .update() method.
Keywords: perf
No longer blocks: tarako-marketplace
Blocks: 992365
No longer blocks: 992365
Priority: -- → P2
Whiteboard: [repoman]
<instance>.update() actually calls <instance>.__class__>.objects.filter(pk=<instance>.pk).update(...), so it's already doing the right thing. Not sure why I thought it wasn't. Nevertheless, it does some hackery with signals that wouldn't be necessary anymore if using .save(update_fields=[...]) so this bug is still relevant, just less important.
Priority: P2 → P3
Priority: P3 → P4
Keywords: perf
Assignee: nobody → mpillard
Fixed in https://github.com/mozilla/zamboni/commit/92661c1633e755776433a68af12f5cc36de0d7fd QA: - Every part of the site that saves data could be affected by this change. Please test that submitting an app and reviewing it still works, that should be enough to verify that it works properly.
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → 2015-09-22
Verified in FF43(Win7) in marketplace-dev.allizom.org Submitting and reviewing apps still works. There is an issue when adding content rating. There is a bug for that: Bug 1206089 Mathieu do you think this is related?
Flags: needinfo?(mpillard)
No, Content Ratings were broken already. See https://bugzilla.mozilla.org/show_bug.cgi?id=1203489
Flags: needinfo?(mpillard)
Ok, thanks. Closing bug.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.