ModelAdmin.queryset() is missing a mechanism for specifying different querysets for changelist and change object views
|Reported by:||mrts||Owned by:||nobody|
|Cc:||marcoberi@…, andy@…||Triage Stage:||Accepted|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
ModelAdmin.queryset() is used both in the changelist and change object views.
Suppose some fields are deferred in the returned queryset to speed up changelist rendering. As a result, the object change view has to perform additional queries for all the deferred fields to pull them in.
The proposed solution is to add another parameter to
queryset() that specifies whether a changelist or change object queryset should be returned as follows:
def queryset(self, request, for_change_object_view=False):