In general, Q() objects make it possible to define and reuse conditions.
This permits the construction of complex database queries using |
(OR) and & (AND) operators; **in particular, it is not otherwise
possible to use OR in QuerySets**.
It's possible to use OR without Q objects by simply using the | operator
on two querysets, e.g:
{{{
queryset = Article.objects.filter(headline__startswith='Hello') |
Article.objects.filter(headline__startswith='Goodbye')
}}}
Examples of this still remain in in the or_lookups tests, although I must
confess I haven't used this style much.
Perhaps the wording should be changed, or simply removed.
--
Ticket URL: <https://code.djangoproject.com/ticket/28177>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* owner: nobody => Yoong Kang Lim
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/28177#comment:1>
* status: assigned => closed
* type: Uncategorized => Cleanup/optimization
* resolution: => duplicate
Comment:
Duplicate of #21333
--
Ticket URL: <https://code.djangoproject.com/ticket/28177#comment:2>