Opened 4 years ago

Last modified 4 years ago

#32170 closed Uncategorized

Admin select_related is different to the model's select related — at Initial Version

Reported by: Michael Owned by: nobody
Component: Uncategorized Version: 3.1
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In a model one can do .select_related('foo__bar').

However in the admin view if one has select_related = ('foo__bar', ) it raises the error Non-relational field given in select_related: 'bar'. Choices are: .... One has to do select_related = ('foo', ). Hence to select only certain fields, one has to override the get_queryset.

Seems a bit inconsistent? I guess it goes hand in hand with not allowing foreign key fields in list display (#5863) etc.

Change History (0)

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