Ticket #4373: modeltests.get_object_or_404.models.py.diff

File modeltests.get_object_or_404.models.py.diff, 831 bytes (added by SuperJared, 17 years ago)

Diff for tests/modeltests/get_object_or_404/models.py

  • modeltests/get_object_or_404/models.py

     
    6969>>> get_object_or_404(Article.by_a_sir, title="Run away!")
    7070<Article: Run away!>
    7171
     72# QuerySets can be used too
     73>>> get_object_or_404(Article.objects.all(), title__contains="Run")
     74<Article: Run away!>
     75
    7276# get_list_or_404 can be used to get lists of objects
    7377>>> get_list_or_404(a.article_set, title__icontains='Run')
    7478[<Article: Run away!>]
     
    8387>>> get_list_or_404(Article.by_a_sir, title__icontains="Run")
    8488[<Article: Run away!>]
    8589
     90# QuerySets can be used too
     91>>> get_list_or_404(Article.objects.all(), title__icontains="Run")
     92[<Article: Run away!>]
     93
    8694"""}
Back to Top