Opened 5 years ago

Closed 5 years ago

#31705 closed Bug (invalid)

Bad way to select default filter parameter from "n total" link

Reported by: Compro Prasad Owned by: nobody
Component: contrib.admin Version: 3.0
Severity: Normal Keywords: django, admin, filter, search, link
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

To n total link is shown in Django Admin panel beside the search button at the top of the list view page. When you click on this link all the filters are cleared in order to show all the values.

The issue happens when you change the default filter behavior when rendering the list. I followed https://stackoverflow.com/questions/851636/default-filter-in-django-admin#answer-16556771 which works fine for a default filter but breaks the n total link.

For example, if there are a total of 5 records and the default filter shows only 2 of them then clicking on n total link will also show only 2 of them.

https://pasteboard.co/JcZR5zK.png - Default list view

https://pasteboard.co/JcZRDpr.png - After clicking on 5 total link. Notice the change in URL. This should show all the records but it doesn't

Currently I haven't found a simple builtin way to fix this without actually changing the template.

Change History (1)

comment:1 by Carlton Gibson, 5 years ago

Resolution: invalid
Status: newclosed

Sorry, I can't see that this is supported usage.

You've filtered the default queryset, so when that queryset is used, the results will be filtered. If you want to show all results you can't filter the queryset. (No doubt with enough machinations what you're trying to do would be possible…)

Note: See TracTickets for help on using tickets.
Back to Top