Django

Code

Changeset 2897

Show
Ignore:
Timestamp:
05/11/06 16:51:24 (3 years ago)
Author:
lukeplant
Message:

Updated 'or_lookup' tests to give example of more compact syntax, for the sake of autogenerated docs.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/tests/modeltests/or_lookups/models.py

    r2850 r2897  
    4545[] 
    4646 
    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') 
    4851[] 
    4952 
    50 >>> Article.objects.filter(headline__startswith='Hello') & Article.objects.filter(headline__contains='bye') 
     53>>> articles.filter(headline__startswith='Hello') & articles.filter(headline__contains='bye') 
    5154[Hello and goodbye] 
    5255