Opened 10 months ago

Closed 10 months ago

Last modified 10 months ago

#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 Christophe Henry)

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 Christophe Henry, 10 months ago

Component: Uncategorizedcontrib.admin
Description: modified (diff)
UI/UX: set

comment:2 by Mariusz Felisiak, 10 months ago

Cc: Marcelo Galigniana added
Type: UncategorizedCleanup/optimization

comment:3 by Marcelo Galigniana, 10 months ago

Owner: changed from nobody to Christophe Henry
Status: newassigned
Last edited 10 months ago by Marcelo Galigniana (previous) (diff)

comment:4 by Mariusz Felisiak, 10 months ago

Resolution: needsinfo
Status: assignedclosed

I don't think that removing open will make much of a difference as exactly the same HTML will be build (with all options).

comment:5 by Marcelo Galigniana, 10 months 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?

Last edited 10 months ago by Marcelo Galigniana (previous) (diff)

in reply to:  5 comment:6 by Mariusz Felisiak, 10 months 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.

comment:7 by Marcelo Galigniana, 10 months ago

Yes! I agree with you +1

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