diff options
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>] |
