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)

select_related_list.patch (1.4 KB ) - added by Martín Conte Mac Donell 16 years ago.
patch against #8290

Download all attachments as: .zip

Change History (2)

by Martín Conte Mac Donell, 16 years ago

Attachment: select_related_list.patch added

patch against #8290

comment:1 by Jacob, 16 years ago

Resolution: wontfix
Status: newclosed

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.
Back to Top