Answer the question
In order to leave comments, you need to log in
How to convert such request to ORM?
Hello, I want to make such selections
SELECT * FROM posts WHERE category.id = id AND tag.id IN (1, 2, 3)
Answer the question
In order to leave comments, you need to log in
`Post.objects.filter(category=category_id, tag__in=(1, 2, 3))`
Engine repair through the exhaust pipe. Models to see. I suspect something like this
Post.objects.filter(category_id=cat_id, tag_id__in=[1, 2, 3])
Posts.objects.filter(category=category.name, tags__in=(tag1, tag2, tag3))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question