Opened 3 years ago

Closed 3 years ago

#24417 closed New feature (fixed)

Add ModelAdmin.get_list_select_related()

Reported by: Anshuman Aggarwal Owned by: Loek van Gent
Component: contrib.admin Version: master
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Since other list options such as list_display has a corresponding dynamic function such as get_list_display, select_related should have the same to dynamically specify the related models to retrieve.

Use case: If you dynamically include foreign key columns in list_display, then you would like the ability to dynamically specify the select_related also. Otherwise the queries are not as efficient as select_related allows them to be.

Change History (6)

comment:1 Changed 3 years ago by Anshuman Aggarwal

Type: UncategorizedBug

Marking as a bug since it feels that the API is inconsistent with the rest and its an easy win.

comment:2 Changed 3 years ago by Tim Graham

Component: Uncategorizedcontrib.admin
Summary: Django admin opton get_list_select_related is missingAdd ModelAdmin.get_list_select_related()
Triage Stage: UnreviewedAccepted
Type: BugNew feature
Version: 1.7master

comment:3 Changed 3 years ago by Loek van Gent

Owner: changed from nobody to Loek van Gent
Status: newassigned

comment:4 Changed 3 years ago by Marten Kenbeek

Triage Stage: AcceptedReady for checkin

comment:5 Changed 3 years ago by Collin Anderson

Has patch: set

comment:6 Changed 3 years ago by Tim Graham <timograham@…>

Resolution: fixed
Status: assignedclosed

In 35b3158:

Fixed #24417 -- Added ModelAdmin.get_list_select_related()

Note: See TracTickets for help on using tickets.
Back to Top