mirror of
https://github.com/django/django.git
synced 2024-12-23 09:36:06 +00:00
Updated 'or_lookup' tests to give example of more compact syntax, for the sake of autogenerated docs.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@2897 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
edce4128e1
commit
4116403a55
@ -44,10 +44,13 @@ API_TESTS = """
|
||||
>>> Article.objects.filter(Q(headline__startswith='Hello') & Q(headline__startswith='Goodbye'))
|
||||
[]
|
||||
|
||||
>>> Article.objects.filter(headline__startswith='Hello') & Article.objects.filter(headline__startswith='Goodbye')
|
||||
# You can shorten this syntax with code like the following,
|
||||
# which is especially useful if building the query in stages:
|
||||
>>> articles = Article.objects.all()
|
||||
>>> articles.filter(headline__startswith='Hello') & articles.filter(headline__startswith='Goodbye')
|
||||
[]
|
||||
|
||||
>>> Article.objects.filter(headline__startswith='Hello') & Article.objects.filter(headline__contains='bye')
|
||||
>>> articles.filter(headline__startswith='Hello') & articles.filter(headline__contains='bye')
|
||||
[Hello and goodbye]
|
||||
|
||||
>>> Article.objects.filter(Q(headline__contains='bye'), headline__startswith='Hello')
|
||||
|
Loading…
Reference in New Issue
Block a user