modlinltd / django-advanced-filters

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

Fix the issue 'AdvancedFilterQueryForm' object has no attribute 'clea… #153

Closed hzung closed 1 year ago

hzung commented 2 years ago

…ned_data'

asfaltboy commented 2 years ago

Thanks for opening a PR @hzung (and for following up on it @MAbdurrehman1); could either of you provide some more details on where you experience this issue? P.s: a reproducible step-by-step (or even better: a failing test) would be great!

mrsarm commented 2 years ago

Thanks for opening a PR @hzung (and for following up on it @MAbdurrehman1); could either of you provide some more details on where you experience this issue? P.s: a reproducible step-by-step (or even better: a failing test) would be great!

@asfaltboy if you want to reproduce it, checkout my open source Django project Django Coleman: https://github.com/mrsarm/django-coleman . I used to have a pinned version of django-advanced-filters working OK, but when I did the upgrade to Django 3.2 the project start to fail with this error that happens not when launching the app but when trying to apply a filter:

django-advance-filter-error

Installing django-advanced-filters with the version of this PR worked, this is the commit where I made the upgrade of Django with django-advanced-filters installed from this PR, if you try to change in the requirements.txt with the latest version of django-advanced-filters you will see the error.

asfaltboy commented 1 year ago

Thanks for the additional information @mrsarm . Just looking at the screenshot, this looks like this is caused by an empty option being allowed to pass validation. Is it true that this used to work well in older versions? What used to happen then, would it show a validation error?

mrsarm commented 1 year ago

Thanks for the additional information @mrsarm . Just looking at the screenshot, this looks like this is caused by an empty option being allowed to pass validation. Is it true that this used to work well in older versions? What used to happen then, would it show a validation error?

What do you mean with empty options? you mean I left empty the options in the field for the filtering? I'll test during next week, but still the UI shouldn't allow me to save an invalid set of configurations and then fail if that is the case, maybe as you said that is the cause, but in older versions some JS or server side validation prevented the configuration to be saved, because the same action ended up in a different result with older versions, but I can't recall at this point.

asfaltboy commented 1 year ago

FWIW, I was not able to reproduce the issue described in 2.0. @mrsarm if you still have issues with the latest version, please open a new ticket with all the details + step-by-step example on how one could reproduce this.