Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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
  • Loading branch information...
commit 4116403a55fd816220703a8ae9f3ed592131ba5a 1 parent edce412
Luke Plant authored May 11, 2006

Showing 1 changed file with 5 additions and 2 deletions. Show diff stats Hide diff stats

  1. 7  tests/modeltests/or_lookups/models.py
7  tests/modeltests/or_lookups/models.py
@@ -44,10 +44,13 @@ def __repr__(self):
44 44
 >>> Article.objects.filter(Q(headline__startswith='Hello') & Q(headline__startswith='Goodbye'))
45 45
 []
46 46
 
47  
->>> Article.objects.filter(headline__startswith='Hello') & Article.objects.filter(headline__startswith='Goodbye')
  47
+# You can shorten this syntax with code like the following,
  48
+# which is especially useful if building the query in stages:
  49
+>>> articles = Article.objects.all()
  50
+>>> articles.filter(headline__startswith='Hello') & articles.filter(headline__startswith='Goodbye')
48 51
 []
49 52
 
50  
->>> Article.objects.filter(headline__startswith='Hello') & Article.objects.filter(headline__contains='bye')
  53
+>>> articles.filter(headline__startswith='Hello') & articles.filter(headline__contains='bye')
51 54
 [Hello and goodbye]
52 55
 
53 56
 >>> Article.objects.filter(Q(headline__contains='bye'), headline__startswith='Hello')

0 notes on commit 4116403

Please sign in to comment.
Something went wrong with that request. Please try again.