Ticket #4373: modeltests.get_object_or_404.models.py.diff
File modeltests.get_object_or_404.models.py.diff, 831 bytes (added by , 17 years ago) |
---|
-
modeltests/get_object_or_404/models.py
69 69 >>> get_object_or_404(Article.by_a_sir, title="Run away!") 70 70 <Article: Run away!> 71 71 72 # QuerySets can be used too 73 >>> get_object_or_404(Article.objects.all(), title__contains="Run") 74 <Article: Run away!> 75 72 76 # get_list_or_404 can be used to get lists of objects 73 77 >>> get_list_or_404(a.article_set, title__icontains='Run') 74 78 [<Article: Run away!>] … … 83 87 >>> get_list_or_404(Article.by_a_sir, title__icontains="Run") 84 88 [<Article: Run away!>] 85 89 90 # QuerySets can be used too 91 >>> get_list_or_404(Article.objects.all(), title__icontains="Run") 92 [<Article: Run away!>] 93 86 94 """}