Opened 18 years ago
Closed 18 years ago
#5020 closed (fixed)
select_related() implicit joins
| Reported by: | Owned by: | nobody | |
|---|---|---|---|
| Component: | Database layer (models, ORM) | Version: | dev | 
| Severity: | Keywords: | qs-rf-fixed | |
| Cc: | jesse.lovelace@…, tailofthesun@…, gav@… | Triage Stage: | Accepted | 
| Has patch: | yes | Needs documentation: | yes | 
| Needs tests: | no | Patch needs improvement: | no | 
| Easy pickings: | no | UI/UX: | no | 
Description
Add support for implicitly selecting fields to join with.
e.g. MyModel.objects.all().select_related('myforeignkey__user')
Attachments (5)
Change History (17)
by , 18 years ago
| Attachment: | query.py.diff added | 
|---|
comment:1 by , 18 years ago
| Has patch: | set | 
|---|---|
| Needs documentation: | set | 
| Needs tests: | set | 
comment:2 by , 18 years ago
| Needs tests: | unset | 
|---|
comment:3 by , 18 years ago
The patches provided didn't actually filter my related objects, as_recurse_fields was never saved when cloned and fields= wasn't supplied to the functions. I added a patch with that.
Thanks for doing this. I had rolled my own for this, but it wasn't nearly as clean.
comment:4 by , 18 years ago
| Owner: | changed from to | 
|---|---|
| Triage Stage: | Unreviewed → Design decision needed | 
Haven't heard from Malcolm about it yet.
comment:5 by , 18 years ago
| Cc: | added | 
|---|
comment:6 by , 18 years ago
| Keywords: | qs-rf added | 
|---|
comment:7 by , 18 years ago
| Cc: | added | 
|---|
comment:8 by , 18 years ago
| Cc: | added | 
|---|
comment:9 by , 18 years ago
comment:10 by , 18 years ago
| Keywords: | qs-rf-fixed added; qs-rf removed | 
|---|
comment:11 by , 18 years ago
| Triage Stage: | Design decision needed → Accepted | 
|---|
Promoting to accepted: if it's fixed in the queryset refactor then it has obviously an accepted issue.
comment:12 by , 18 years ago
| Resolution: | → fixed | 
|---|---|
| Status: | new → closed | 
(In [7477]) Merged the queryset-refactor branch into trunk.
This is a big internal change, but mostly backwards compatible with existing
code. Also adds a couple of new features.
Fixed #245, #1050, #1656, #1801, #2076, #2091, #2150, #2253, #2306, #2400, #2430, #2482, #2496, #2676, #2737, #2874, #2902, #2939, #3037, #3141, #3288, #3440, #3592, #3739, #4088, #4260, #4289, #4306, #4358, #4464, #4510, #4858, #5012, #5020, #5261, #5295, #5321, #5324, #5325, #5555, #5707, #5796, #5817, #5987, #6018, #6074, #6088, #6154, #6177, #6180, #6203, #6658
I've attached a patch. It needs unittests and should be tested with trunk.