carltongibson / django-filter

A generic system for filtering Django QuerySets based on user selections

Home Page:https://django-filter.readthedocs.io/en/main/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

django-filter chokes if model has a FileField or ImageField

petasis opened this issue · comments

Hi all,

If a model has a file or an image, django-filter generates an exception.
Raises an exception:

AssertionError: AutoFilterSet resolved field 'document' with 'exact' lookup to an unrecognized field type FileField. Try adding an override to 'Meta.filter_overrides'. See: https://django-filter.readthedocs.io/en/main/ref/filterset.html#customise-filter-generation-with-filter-overrides

My first question is why the package does not exclude these fields by default?

And then, what to add to Meta.filter_overrides to exclude these fields?

Also, Meta.filter_overrides does not seem to work, I think it is empty, even if I have defined the property.

See the discussion on #1478