modlinltd / django-advanced-filters

Add advanced filtering abilities to Django admin
https://pypi.org/project/django-advanced-filters/
MIT License
775 stars 173 forks source link

Not possible to add another filter in the popup #157

Open eriktelepovsky opened 2 years ago

eriktelepovsky commented 2 years ago

Describe the bug Not possible to add another filter field in the popup.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'model admin'
  2. Click on 'Advanced filter'
  3. Click on 'Add another filter'
  4. See error in the Javascript Console

Expected behavior No error in the console and new field added.

Screenshots image

Details (please complete the following information):

Additional context JavaScript Console: image

Possible fix It works when I comment line 142 in advanced-filters.js:

$('.form-row input.query-value').each(function() {
    // $(this).select2("destroy");
});
asfaltboy commented 2 years ago

That's odd, haven't touched this code for a while... are you configuring your own version of select2 library in settings.SELECT2_JS? If so, could you check which version you're using?