#25701: Add warning to an admin list_view if too many queries are being used
-------------------------------+--------------------------------------
Reporter: jacinda | Owner: jacinda
Type: New feature | Status: assigned
Component: contrib.admin | Version:
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by aaugustin):
We discussed this at Django under the Hood. There aren't that many ways to
detect and report the problem at runtime. I think a check when `DEBUG =
True` is a good idea.
I've had this issue on sites where I use the admin and where I have the
debug toolbar installed in dev. I only discovered and fixed in when I
wondered "doesn't this page feel a bit slow?" I wasn't obvious — just the
difference between 50 and 250 ms.
In my opinion this feature would achieve two results:
1. educate newcomers to Django about the N + 1 queries problem in a
textbook example
2. quickly alert more experienced developers when the accidentally create
such a problem
It would need a way to turn it off on with a ModelAdmin option.
I agree that it feels weird to use `django.contrib.messages` to relay
messages to the developer at runtime. Furthermore, I just realized we have
an ordering problem: the admin templates renders messages before iterating
on the queryset to render the changelist. I can't see how we'd implement
that.
I suppose the more traditional alternative to relay that information to
the developer is through logging.
--
Ticket URL: <https://code.djangoproject.com/ticket/25701#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.03c0aa2bbe2a5cd80ab64981d60bb410%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.