#34718 closed Cleanup/optimization (needsinfo)
Allow django.contrib.admin's ListFilter to render details tag collasped by default
| Reported by: | Christophe Henry | Owned by: | Christophe Henry |
|---|---|---|---|
| Component: | contrib.admin | Version: | 4.2 |
| Severity: | Normal | Keywords: | |
| Cc: | Marcelo Galigniana | Triage Stage: | Unreviewed |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | yes |
Description (last modified by )
Custom ListFilter in django admin can yield a lot of results, in which case, the page can be very long.
This could be solved by adding a details_collapsed = True attribute to the ListFilter class and render the <details> tag according to that attribute.
Change History (7)
comment:1 by , 2 years ago
| Component: | Uncategorized → contrib.admin |
|---|---|
| Description: | modified (diff) |
| UI/UX: | set |
comment:2 by , 2 years ago
| Cc: | added |
|---|---|
| Type: | Uncategorized → Cleanup/optimization |
comment:3 by , 2 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:4 by , 2 years ago
| Resolution: | → needsinfo |
|---|---|
| Status: | assigned → closed |
I don't think that removing open will make much of a difference as exactly the same HTML will be build (with all options).
follow-up: 6 comment:5 by , 2 years ago
Here is the PR where we added the collapse filter arrows (to solve the long page problem): https://github.com/django/django/pull/15424
I wouldn't allow user edit ListFilter as if I'm not wrong, we don't recommend it in https://docs.djangoproject.com/en/4.2/ref/contrib/admin/filters
And add an option in SimpleListFilter to collapse ALL filters by default would make sense?
comment:6 by , 2 years ago
Replying to Marcelo Galigniana:
And add an option in SimpleListFilter to collapse ALL filters by default would make sense?
My point is that if you have ListFilter with a long list of options, you will probably use something other than the built-in ListFilter because collapsing options by default would not solve the long-rendering issue.