Skip to content

Search on FileField.name #1678

Answered by carltongibson
3ng7n33r asked this question in Q&A
Jul 19, 2024 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

Hi @3ng7n33r

So the example from has #1478 this:

class QuestionnaireFilter(FilterSet):
    class Meta:
        model = Questionnaire
        fields = ['file']
        filter_overrides = {
            models.FileField: {
                'filter_class': CharFilter,
                'extra': lambda f: {'lookup_expr': 'exact'},
            },
        }

Would adding that to the filter_overrides doc solve your problem?

(The bottom line is I'm still not convinced filtering on FileField is particularly well defined, so would much rather folks define what they need for their own projects than add something not great to the package itself.)

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@3ng7n33r
Comment options

@carltongibson
Comment options

@3ng7n33r
Comment options

Answer selected by 3ng7n33r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants