Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow any iterable for IN operator #443

Open
Lucidiot opened this issue Apr 26, 2019 · 1 comment
Open

Allow any iterable for IN operator #443

Lucidiot opened this issue Apr 26, 2019 · 1 comment

Comments

@Lucidiot
Copy link

The in operator in queries only allows lists or tuples, while all it requires is any kind of iterable, like dicts, sets, frozensets, or even Django's QuerySets:

SomeNode.nodes.filter(
    some_property__in=SomeModel.objects.values_list('some_field', flat=True)
)

Currently, to get this to work, the Django QuerySet must be wrapped in list(), an unnecessary addition. One might use collections.abc.Iterable with isinstance to check for a valid iterable.

@aanastasiou
Copy link
Collaborator

@Lucidiot Thanks for bringing this to our attention, sounds good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants