Opened 7 years ago
Last modified 6 years ago
#28917 closed Cleanup/optimization
Remove paginator's unordered queryset warning for a .none() queryset — at Version 2
Reported by: | Jeremy Lainé | Owned by: | Junji Wei |
---|---|---|---|
Component: | Core (Other) | Version: | 2.0 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description (last modified by )
Paginator
shows a warning if it receives an unordered queryset.
However, if also emits this warning if passed a queryset which is guaranteed to be empty, for instance Article.objects.none()
.
Working around this warning involves doing a bizarre Article.objects.none().order_by('id')
I believe there can be legitimate usecases for passing a .none()
queryset to a paginator, for instance if a user's permissions are such that we restrict the objects they can view to the empty queryset.
Change History (2)
comment:1 by , 7 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 7 years ago
Component: | Generic views → Core (Other) |
---|---|
Description: | modified (diff) |
Summary: | Paginator shows ordering warning on an empty .none() queryset → Remove paginator's unordered queryset warning for a .none() queryset |
Triage Stage: | Unreviewed → Accepted |
Type: | Bug → Cleanup/optimization |