I read some model operation from Django’s document, and find this
I’m curious that OR in WHERE is just basic concept, why Django think it’s a complex query?
Advertisement
Answer
Actually, what’s “more complex” here is the full query syntax, whatever the logical operator. The full syntax for an “AND” query is
MyModel.objects.filter(Q(foo="bar") & Q(quux="baaz"))
but since in practice you more often use AND queries than OR queries, the ORM provides a shortcut for AND queries:
MyModel.objects.filter(foo="bar", quux="baaz")