graphql-python / graphql-python/graphene-django

AND clause used instead of OR while filtering

Open
#1,519 0 comments 0 reactions 0 assignees View on GitHub
🐛bug
Dominant language
Python
Stars
4.4k
Forks
760
PR merge metrics
No merged PRs in 30d

Description

**Note: for support questions, please use stackoverflow**. This repository's issues are reserved for feature requests and bug reports.

* **What is the current behavior?**
So currently on using a Filterset class graphene-django filter is used, which uses AND instead of OR for lookup "IN"

* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** via
a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).
```
class ExampleFilterSet(FilterSet):
label__name__in = StringInFilter(method="filter_labels")

class Meta:
model = Example
fields = {"users__email": ["in"]}
```

Ideally, here it should have been OR query - where users__email in ['abc@gmail.com' , 'xyz@gmail.com'] but on debugging it simply empties the clone object and returns empty qs.

It was working well with django3.1 and graphene-django 2.9.9

* **What is the expected behavior?**
The OR clause should be there in the ultimate sql query formed

* **What is the motivation / use case for changing the behavior?**
carry the normal functioning

* **Please tell us about your environment:**

- Version: 3.1.2
- Platform: macos

* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.