B
B
bQ12019-12-04 09:43:47
Django
bQ1, 2019-12-04 09:43:47

How to filter a Django queryset?

How to filter a Django queryset?
I don't know how to explain, so I'll give an example:
TestModel.objects.filter(field__in=[1,2,3]) - how to make the queriset contain all objects that have at least one of the listed? Now returns only those that have all three values ​​at the same time
Object Q tried, but it is not known in advance how many parameters will be in []

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2019-12-04
@bQ1

QuerySet API reference: Field lookups

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question