modlinltd/django-advanced-filters

Only one filter shows field_choices

JuanPabloMF opened this issue · 2 comments

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

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

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