Clear all filters

87 views
Skip to first unread message

Fran Hrženjak

unread,
May 16, 2020, 6:04:19 PM5/16/20
to django-d...@googlegroups.com
Hi,

I just saw the new “Clear all filters” link in the admin in 3.1a1. Love it! But I noticed something that perhaps deserves a discussion. Since the PR has already been merged, I’m posting here instead.

The thing is that clicking “Clear all filters” also clears the search query and table ordering. The way I expected it to work is to, well, “clear all filters” and nothing else. Basically to act like a shortcut for clicking “All” on each filter individually. Doing so (clicking every “All” link) preserves search query and ordering. Should “Clear all filters” also preserve those things?

I would love to hear your thoughts on this.

Ref:


Select_answer_to_change___Django_site_admin.png

P.S.
I noticed this while making a PR for a related issue: https://code.djangoproject.com/ticket/31597

Mariusz Felisiak

unread,
May 18, 2020, 12:36:29 AM5/18/20
to Django developers (Contributions to Django itself)
Hi,

 IMO the current behavior is expected, it is also included in the ticket description (see comment[1]).

Adam Johnson

unread,
May 18, 2020, 4:30:13 AM5/18/20
to django-d...@googlegroups.com
I disagree Mariusz. I would NOT expect this. The "Clear all filters" button is grouped with the filters, visually separate from the search and sort controls. It's a very legitimate use case to clear the filters and maintain the search or sort, and quite a common workflow when trying to find a particular object.

Additionally, I see that the link only preserves the _popup=1 query param. if users have extended their admin views with any extra query params, they will also be wiped, which is less than helpful. I know I have extended the admin with extra params before e.g. to control the queryset.

I'm +1 on changing this to take the current query params and remove only the filter-related ones.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/56339b28-59a3-4e41-b364-adf7faa4cb83%40googlegroups.com.


--
Adam

Mariusz Felisiak

unread,
May 18, 2020, 5:10:03 AM5/18/20
to Django developers (Contributions to Django itself)
I disagree Mariusz. I would NOT expect this. The "Clear all filters" button is grouped with the filters, visually separate from the search and sort controls. It's a very legitimate use case to clear the filters and maintain the search or sort, and quite a common workflow when trying to find a particular object.

The idea of this feature was to remove all filters and search criteria in one click (see the ticket description[2]). The first proposition was to put this link in actions [2], but I proposed moving it to filters. I'm not sure if link for clearing only filters is still necessary (and it wasn't the intention of reporter), we can remove this feature if it's misleading. Link to the right of the search box ("X total") already removes the entire query string, so ...

Additionally, I see that the link only preserves the _popup=1 query param. if users have extended their admin views with any extra query params, they will also be wiped, which is less than helpful. I know I have extended the admin with extra params before e.g. to control the queryset.

Link to the right of the search box ("X total") that was added in 2005 [3] do the same. We should probably use `add_preserved_filters`.

Markus Holtermann

unread,
May 18, 2020, 7:48:31 AM5/18/20
to Django developers
I tend to agree with Adam.

From a UI/UX perspective, the location where the "Clear all filters" button is, as well as the wording, suggest to me that it's only the filters on the right side. The search query, while technically filtering the query set, doesn't seem like a filter in the UI.

I'd potentially argue otherwise if the search field was in the filter box on the right.

Additionally, looking at it from the back-end, search terms and filters have nothing in common except for the queryset.

Cheers,

Markus


On Mon, May 18, 2020, at 11:10 AM, Mariusz Felisiak wrote:
> > I disagree Mariusz. I would NOT expect this. The "Clear all filters" button is grouped with the filters, visually separate from the search and sort controls. It's a very legitimate use case to clear the filters and maintain the search or sort, and quite a common workflow when trying to find a particular object.
>
> The idea of this feature was to remove all filters and *search
> criteria* in one click (see the ticket description[2]). The first
> proposition was to put this link in actions [2], but I proposed moving
> it to filters. I'm not sure if link for clearing only filters is still
> necessary (and it wasn't the intention of reporter), we can remove this
> feature if it's misleading. Link to the right of the search box ("X
> total") already removes the entire query string, so ...
>
> > Additionally, I see that the link only preserves the _popup=1 query param. if users have extended their admin views with any extra query params, they will also be wiped, which is less than helpful. I know I have extended the admin with extra params before e.g. to control the queryset.
>
> Link to the right of the search box ("X total") that was added in 2005
> [3] do the same. We should probably use `add_preserved_filters`.
>
> [1] https://code.djangoproject.com/ticket/27888
> [2] https://github.com/django/django/pull/12351#issuecomment-577415747
> [3]
> https://github.com/django/django/commit/9dda4abee1225db7a7b195b84c915fdd141a7260
>
> --
> You received this message because you are subscribed to the Google
> Groups "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-develop...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/ed3810c9-bb86-4e05-97dd-4818efa1617c%40googlegroups.com <https://groups.google.com/d/msgid/django-developers/ed3810c9-bb86-4e05-97dd-4818efa1617c%40googlegroups.com?utm_medium=email&utm_source=footer>.

Mariusz Felisiak

unread,
May 18, 2020, 10:15:26 AM5/18/20
to Django developers (Contributions to Django itself)

Thanks y'all

Fran Hrženjak

unread,
May 18, 2020, 4:40:45 PM5/18/20
to Django developers (Contributions to Django itself)
Here is my dream rework of these links. I’m NOT saying we need to do this now now now (i.e part of this ticket), but I’m interested to hear if this is something that could be accepted by the community.

A few highlights:
  • fairly backwards compatibl (the "X total" link is only moved a bit in DOM, other elements are new)
  • separates clearing of search from clearing of filters
  • always shows relevant elements regardless of fealters and/or search being enabled on the changelist
I would not have proposed this if we don’t have the new “Clear all filters” links because, IMHO the new link functions also as a visual cue to see if there are any active filters. Prevbiously it was easy to miss an active filter, and so having the “X total” link (next to search field) also clear the filters made sense. Now that we have a better visual indication of any active filter(s), IMHO it makes sense to decouple clearing of search from filters.



Select_user_to_change___Django_site_admin-2.png



mobile:

Select_user_to_change___Django_site_admin-3.png


Aymeric Augustin

unread,
May 19, 2020, 3:13:15 AM5/19/20
to django-d...@googlegroups.com
On 18 May 2020, at 11:10, Mariusz Felisiak <felisiak...@gmail.com> wrote:

Link to the right of the search box ("X total") already removes the entire query string, so ...

Ah, this is a bug I'm hitting!

I have a small personal app where I classify data. Some classification is automated with regexes. New data needs to be classified manually.

My typical workflow is:

- filter on unclassified data
- find something interesting
- use the search field to find all similar data
- classify it (directly in the list view, thanks to list_editable)
- clear the search => I lose my filter :-(
- filter on unclassified data again
- etc.

Having to set the filter again and again is a minor annoyance so I haven't bothered to report a bug. But it's the wrong behavior in this case.

Best regards,

-- 
Aymeric.



Adam Johnson

unread,
May 19, 2020, 5:56:59 AM5/19/20
to django-d...@googlegroups.com
Fran, your design looks nice. I think we should make a ticket that combines making the "X total" link preserve the query params and adding your other suggested changes.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-develop...@googlegroups.com.


--
Adam
Reply all
Reply to author
Forward
0 new messages