Skip to content

enhance automatic filter lookups #1474

Answered by carltongibson
gecBurton asked this question in Q&A
Discussion options

You must be logged in to vote

See Generating filters with Meta.fields in the usage guide.

If you want to customise the lookups you can pass a dict (or declare the equivalent filters manually):

class ProductFilter(django_filters.FilterSet):
    class Meta:
        model = Product
        fields = {
            'price': ['lt', 'gt'],
            'release_date': ['exact', 'year__gt'],
        }

Is it not possible to fetch all possible lookups like...

How you generate that dict is up to you.

See also LookupChoiceFilter

Replies: 1 comment 3 replies

Comment options

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

@carltongibson
Comment options

@gecBurton
Comment options

Answer selected by gecBurton
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
Converted from issue

This discussion was converted from issue #1473 on January 27, 2022 10:17.