Opened 13 years ago
Closed 12 years ago
#16856 closed New feature (fixed)
Add a way to clear select_related
Reported by: | Carl Meyer | Owned by: | nobody |
---|---|---|---|
Component: | Database layer (models, ORM) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | jdunck@…, seldon, botondus@…, timograham@… | Triage Stage: | Accepted |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If you've got a queryset that has had select_related called on it (maybe passed to you from some other code you don't control) there's currently no documented way to clear out select_related.
One possible API is .select_related(None), which mirrors how .defer() works.
The combination of this and #16855 would make .select_related() and .defer() more consistent with each other, which would be nice.
Change History (8)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 13 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
Cc: | added |
---|
comment:4 by , 12 years ago
Cc: | added |
---|
comment:5 by , 12 years ago
For anyone reading this, the undocumented hacky way to do this is:
qs.query.select_related = False
comment:7 by , 12 years ago
Cc: | added |
---|---|
Has patch: | set |
Added a release note & brought patch up to date.
comment:8 by , 12 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
There was a clear consensus on this API in #django-dev.