#12893 closed (fixed)
Pagination in admins changelist doesn't use queryset set by modeladmin
Reported by: | Willian | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 1.2-alpha |
Severity: | 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
When the queryset method in a ModelAdmin gets overwriten (to for example filter some records out) the changelist uses the given queryset, but the pagination counts all records including the ones that filtered out by the get_queryset.
Attachments (2)
Change History (7)
comment:1 by , 15 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 14 years ago
Has patch: | set |
---|
by , 14 years ago
Attachment: | test12893.patch added |
---|
by , 14 years ago
Attachment: | 12893_modeladmin_pagination_tests.diff added |
---|
comment:3 by , 14 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
I confirm that everything works fine, but it doesn't hurt adding more regression tests so thank you mk for your patch. I've just updated it by explicitly using list_per_page
, reducing the number of created objects (anything we can do to speed up the test suite :-) ), and writing tests for when the default queryset is used.
I cannot reproduce this problem, neither on 1.2 nor on current trunk. Unittest attached.