Skip to content

Filtering records by related fields #301

Closed Answered by peteeckel
kemeris2000 asked this question in Q&A
Discussion options

You must be logged in to vote

OK, done. It's a 'feature'.

In the current implementation of filtersets filter expressions apparently filters can't be nested, so in order to do fully orthogonal nested filtering all filters related to Zone need to be redefined in the filterset for Record in order to be usable in queries. This does not really scale.

Example: You can filter for zone (name), zone_id, view (name) and view_id because the following filters are defined:

    zone_id = django_filters.ModelMultipleChoiceFilter(
        queryset=Zone.objects.all(),
        label="Parent Zone ID",
    )
    zone = django_filters.ModelMultipleChoiceFilter(
        queryset=Zone.objects.all(),
        field_name="zone__name",
        t…

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by kemeris2000
Comment options

You must be logged in to vote
1 reply
@peteeckel
Comment options

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