diff options
| author | Russell Keith-Magee <russell@keith-magee.com> | 2006-07-01 03:14:33 +0000 |
|---|---|---|
| committer | Russell Keith-Magee <russell@keith-magee.com> | 2006-07-01 03:14:33 +0000 |
| commit | cd7b54aab0c087ba6efd4a86ae0ecb6ed55d7e4b (patch) | |
| tree | e6c05b0d83f0cd482839b381f3365783b4969087 /tests | |
| parent | 4a324ba7acd2660538a81b1fb423de89ff515665 (diff) | |
Fixes #2271 -- Added code to imply !__exact on any query argument that doesn't finish with a known query term.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@3248 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/many_to_one/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/modeltests/many_to_one/models.py b/tests/modeltests/many_to_one/models.py index b7d27e2ed3..d202975128 100644 --- a/tests/modeltests/many_to_one/models.py +++ b/tests/modeltests/many_to_one/models.py @@ -136,6 +136,10 @@ False >>> Article.objects.filter(reporter__first_name__exact='John') [<Article: John's second story>, <Article: This is a test>] +# Check that implied __exact also works +>>> Article.objects.filter(reporter__first_name='John') +[<Article: John's second story>, <Article: This is a test>] + # Query twice over the related field. >>> Article.objects.filter(reporter__first_name__exact='John', reporter__last_name__exact='Smith') [<Article: John's second story>, <Article: This is a test>] @@ -237,6 +241,10 @@ TypeError: Cannot resolve keyword 'reporter_id' into field >>> Reporter.objects.filter(article__reporter__exact=r).distinct() [<Reporter: John Smith>] +# Check that implied __exact also works +>>> Reporter.objects.filter(article__reporter=r).distinct() +[<Reporter: John Smith>] + # If you delete a reporter, his articles will be deleted. >>> Article.objects.all() [<Article: John's second story>, <Article: Paul's story>, <Article: This is a test>, <Article: This is a test>, <Article: This is a test>] |
