Filterset issue - unrecognized field type FileField
andychoi opened this issue · comments
Andy Choi commented
Here is error.
AssertionError: ProjectFilterSet resolved field 'attachment' 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 class has FileField, but I didn't include it in filter class as below. I tried to exclude, but still not working
class ProjectFilter(django_filters.FilterSet):
class Meta:
model = Project
exclude = ['attachment']
fields = {
'title' : ['icontains'],
'description' : ['icontains'],
}
Carlton Gibson commented
You can't provide fields
and exclude
at the same time. The fields
setting should be sufficient? 🤔