[Answered ]-Django relay filter not working for foreign key field

1👍

Add id as relation like this:

class CommodityItemNode(DjangoObjectType):
    class Meta:
        # rest of code
        filter_fields = {
           'is_online' : ['exact'],
           'brand__id': ['exact']
        }

And in your query:

query {
    allCommodityItem(isOnline: true, brand_Id: "1") {
        edges {
           node {
              name
           }
        }
    }
}

Leave a comment