Q
objects can be combined using the &
and |
operators. When an
operator is used on two Q
objects, it yields a new Q
object.For example, this statement yields a single
Q
object that represents the
“OR” of two "question__startswith"
queries:Q(question__startswith='Who') | Q(question__startswith='What')
WHERE
clause:WHERE question LIKE 'Who%' OR question LIKE 'What%'
No comments:
Post a Comment