Opened 4 years ago

Last modified 4 years ago

#32587 closed Cleanup/optimization

Use RelatedManager of parent object in get_queryset of inlines and support prfetching — at Version 3

Reported by: Andreas Galazis Owned by: nobody
Component: contrib.admin Version: 3.2
Severity: Normal Keywords: admin, prefetch, inline
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description (last modified by Andreas Galazis)

This would help support prefetching configuration on parent admin's queryset.
This is not sufficient to support prefetching since there are multiple (I have found at least 3) instances in inline admin ans inline formset where self.get_queryset()[i] paradigm is used.

At least perform some code cleanup?

Even if this issue a won't fix for any reason at least abstract fetching instance by in index in a ge_instance_by_index method so that we can implement admins that do what we want of top of current base classes. If this is done then we will be able to overwrite ge_instance_by_index to return list(self.get_queryset())[i]

instead of self.get_queryset()[i] on inlines that support prefetching

Change History (3)

comment:1 by Andreas Galazis, 4 years ago

Component: Uncategorizedcontrib.admin
Keywords: admin prefetch inline added

comment:2 by Andreas Galazis, 4 years ago

Type: UncategorizedCleanup/optimization

comment:3 by Andreas Galazis, 4 years ago

Description: modified (diff)
Summary: Use RelatedManager of parent object in get_queryset of inlinesUse RelatedManager of parent object in get_queryset of inlines and support prfetching
Note: See TracTickets for help on using tickets.
Back to Top