Timeline Explain Q objects in Django ORM. - Stack Overflow - Clone
2 events
when what by comment
7 months, 1 week ago upvote galib04 timeline score: 0
7 months, 2 weeks ago answered harun timeline score: 0
 
N/A Keyword argument queries – in filter(), etc. – are “AND”ed together. If you need to execute more complex queries (for example, queries with OR statements), you can use Q objects. 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") ``` This is equivalent to the following SQL WHERE clause: ``` WHERE question LIKE 'Who%' OR question LIKE 'What%' ```