#28219: Paginator warning about unordered object should include stack trace
--------------------------------+--------------------------------------
Reporter: Denise Mauldin | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 1.11
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 Simon Charette):
Hi Denise, thank you for your report.
The `stacklevel` of the `UnorderedObjectListWarning` warning was adjusted
to try to point at the right place in #28109 (shipped in 1.11.1) but it
only accounts for direct `Paginator` manipulation. If you use `ListView`
or `ModelAdmin` pagination features, which rely on `Paginator` internally,
it's possible the warning is not pointing at the right user code location.
I'm afraid this will this be hard to solve without either adjusting all
internal usages of `Paginator` to capture `UnorderedObjectListWarning`
warnings and ''rewarn'' with a `stacklevel` matching the first possible
user entry point but it sounds like a lost cause given the dynamic nature
of queryset definition and generation.
For example
{{{#!python
class FooListView(ListView):
queryset = Foo.objects.all()
paginate_by = 10
}}}
Maybe adjusting `ListView.paginate_queryset()` and `ModelAdmin.
get_paginator()` to rewarn with a message mentioning
`self.__class__.qualname__` would be enough?
--
Ticket URL: <https://code.djangoproject.com/ticket/28219#comment:1>
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/071.5643a35f6f99d729c79dc37aa899f796%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.