Opened 16 years ago
Closed 16 years ago
#8213 closed (wontfix)
Make use of "select_related(tables)" in admin
Reported by: | Martín Conte Mac Donell | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | 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
There is an easy way to make use of select_realated(tables) features in ModelAdmin. By now list_select_related is expecting boolean type but i made a minor change to expect list or tuple. In this way we can specify join tables instead of join all of them.
The change is backward compatible.
Attachments (1)
Change History (2)
by , 16 years ago
Attachment: | select_related_list.patch added |
---|
comment:1 by , 16 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Actually, you don't need this patch at all; you can just override ModelAdmin.queryset()
to do whatever you need there. e.g.:
class MyModelAdmin(ModelAdmin): def queryset(self): return super(MyModelAdmin, self).queryset().select_related('foo__bar__baz', depth=2)
Note:
See TracTickets
for help on using tickets.
patch against #8290