Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: filtered choices get lost when search used after filtering #999

Open
sezginacer opened this issue Jan 23, 2025 · 0 comments
Open

fix: filtered choices get lost when search used after filtering #999

sezginacer opened this issue Jan 23, 2025 · 0 comments

Comments

@sezginacer
Copy link

sezginacer commented Jan 23, 2025

What version of Unfold are you using?

main

What version of Django are you using?

5.1

What browser are you using?

Firefox 135.0

Did you checked changelog/commit history, if the bug is not already fixed?

Yes

Did you searched other issues, if the bug is not already fixed?

Yes

Did you checked documentation?

Yes

Are you able to replicate the bug in the demo site?

No, I could not find MultipleDropdownFilter or MultipleRelatedDropdownFilter on demo site.

Repository with reproduced bug

No

Describe your issue

Suppose we have an admin class like below.

@admin.register(SampleModel)
class SampleModelAdmin(ModelAdmin):
    list_filter = [
        ("status", MultipleDropdownFilter), 
        ("owner", MultipleRelatedDropdownFilter),
        ("writer", MultipleRelatedDropdownFilter),
    ]
  • Go to change_list page.
  • Choose some filters and apply. Then let's say, current URL after filtering is /admin/app/model/?status=open&status=closed&owner__id__exact=1&owner__id__exact=2&owner__id__exact=3&writer__id__exact=5
  • Write 'test' to search form & click enter. Current URL after search is /admin/app/model/?q=test&status=open&owner__id__exact=1&writer__id__exact=5
  • So, status=closed and owner__id__exact=2&owner__id__exact=3 filters get lost.

While just filtering (not searching), there is no problem like this one. But filter a field with multiple values then searching breaks query string & filters.

@sezginacer sezginacer changed the title filtered choices get lost when search used after filtering fix: filtered choices get lost when search used after filtering Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant