Opened 9 years ago

Last modified 12 months ago

#25701 new New feature

Add warning to an admin list_view if too many queries are being used — at Version 2

Reported by: Jacinda Shelly Owned by: Jacinda Shelly
Component: contrib.admin Version: dev
Severity: Normal Keywords:
Cc: jacinda.shelly@…, Ülgen Sarıkavak Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no
Pull Requests:How to create a pull request

Description (last modified by Jacinda Shelly)

If you use a related field in a callable on a Model or ModelAdmin, and then use that callable in list_display, Django doesn't currently have a way to automatically detect that select_related should be used and performs a query for every row in the list.

While it might be possible to do this automatically, a quick way to help with this problem would be to warn a developer with something like django.contrib.messages (if enabled) that a list_view is performing O(n) queries and that they should investigate this as a potential performance issue.

According to the ticket's flags, the next step(s) to move this issue forward are:

  • To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is: [https://github.com/django/django/pull/#### PR].

Change History (2)

comment:1 by Jacinda Shelly, 9 years ago

Cc: jacinda.shelly@… added
Owner: changed from nobody to Jacinda Shelly
Status: newassigned

comment:2 by Jacinda Shelly, 9 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.
Back to Top