Opened 8 years ago
Closed 8 years ago
#28974 closed Cleanup/optimization (fixed)
Model.refresh_from_db() should pass the refreshed instance as a database hint
| Reported by: | Simon Charette | Owned by: | nobody |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev |
| Severity: | Normal | Keywords: | |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
While reviewing the patch for #28918 and reflecting about #28939 I noticed that the refresh_from_db() method was duplicating the work the routers do when an instance hint is provided.
I figured out that we we're better of using db_manager(using, hints={'instance': self}) in this case which would also have the benefit of passing down instance as an hint to possibly defined custom routers.
Note:
See TracTickets
for help on using tickets.
PR