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

Only one filter shows field_choices #184

Open
JuanPabloMF opened this issue Aug 28, 2023 · 2 comments
Open

Only one filter shows field_choices #184

JuanPabloMF opened this issue Aug 28, 2023 · 2 comments

Comments

@JuanPabloMF
Copy link

Describe the bug
Screenshot from 2023-08-28 15-00-34

Currently when I add more than one filter (for example to search "Candidates" that know "python" and "Ruby on Rails") only the first filter shows field_choices.

If I change the field option to "or" and then move it back to "tech" then the field will change after a few seconds, and convert from text box to dropdown with the field_choices.

When I add a new filter, the dropdown from every filter except the first will convert to text box (but without losing the value I choose), again going back to only having a dropdown with choices in the first filter.

To Reproduce

@admin.register(Candidate)
class CandidateAdmin(AdminAdvancedFiltersMixin, admin.ModelAdmin):
    inlines = [
        SkillInline,
        JobInline
        ]
    list_display = [
        "name",
        "family_name",
        "age",
        "country",
        "city",
        "email",
        "phone",
        "last_company",
        "working",
        "salary_type",
        "salary"
        ]
    search_fields = [
        "skill__tech__name__icontains"
        ]
    list_filter = [
        "country",
        "working"
        ]
    advanced_filter_fields = [
         ("skill__tech__name", "tech"),
    ]

Steps to reproduce the behavior:

  1. Go to admin
  2. Go to Candidates List view
  3. Click on Advanced Filter
  4. Start adding new filters

Expected behavior
Normally every filter should have the right form (a dropdown with field_choices instead of a text box)

Details (please complete the following information):

  • OS: Pop OS 6.2
  • Python version 3.9
  • Django version 4.0
  • django-advanced-filters version 2.0
  • Browser Firefox
  • Version 103.0
@JuanPabloMF
Copy link
Author

I forgot to mention also I'm using Django Grappelli 3.0.7

@asfaltboy
Copy link
Member

Hey Juan, it's been a while since I touched this package, so I am getting a bit less confident with the code base.

Can you try out the branch ps/frontend-fixes locally? I think this means to fix a number of frontend issues, and possibly this is one of them

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

2 participants