graphql-python / graphql-python/graphene-django
Filtering based off of ManyToManyField
- Dominant language
- Python
- Stars
- 4.4k
- Forks
- 760
- PR merge metrics
- No merged PRs in 30d
Description
I'm trawling through the documentation and looking up what I know regarding Django Filters and Django, but there doesn't seem to be a way of filtering a `Node` object on a `ManyToMany` instance attribute ... e.g., RelatedName.name doesn't seem to be filterable within `filter_fields = {}` e.g.:
```
filter_fields = {
'categories__name': ['exact', 'icontains', 'istartswith'],
}
```
I just seem to get the following error when attempting to query by `category.name`:
```
{
"errors": [
{
"message": "Unknown argument \"categoriesName\" on field \"allIngredients\" of type \"Query\".",
"locations": [
{
"line": 149,
"column": 15
}
]
}
]
}
```
What would be the best way to achieve filtering based on a ManyToManyField instance attribute?
Contributor guide
Assessment
This issue has not been assessed yet.