diff options
| author | leandrafinger <leandra.finger@gmail.com> | 2013-05-18 13:34:29 +0200 |
|---|---|---|
| committer | Marc Egli <frog32@me.com> | 2013-05-18 18:39:21 +0200 |
| commit | ddd9ee16fa0c7cc19fd472fd7c1f6d28693a89be (patch) | |
| tree | e02522750044d0bb2ec6b8c983b9e5a99c105e53 /docs/intro/tutorial03.txt | |
| parent | cd72c55d8603751af40a55d2d18f264827fa0744 (diff) | |
Add missing imports to the examples in the 'First Steps'
Diffstat (limited to 'docs/intro/tutorial03.txt')
| -rw-r--r-- | docs/intro/tutorial03.txt | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt index 86cc5f97e6..0bbfcdd02f 100644 --- a/docs/intro/tutorial03.txt +++ b/docs/intro/tutorial03.txt @@ -393,6 +393,9 @@ Now, let's tackle the poll detail view -- the page that displays the question for a given poll. Here's the view:: from django.http import Http404 + from django.shortcuts import render + + from polls.models import Poll # ... def detail(request, poll_id): try: @@ -420,6 +423,8 @@ and raise :exc:`~django.http.Http404` if the object doesn't exist. Django provides a shortcut. Here's the ``detail()`` view, rewritten:: from django.shortcuts import render, get_object_or_404 + + from polls.models import Poll # ... def detail(request, poll_id): poll = get_object_or_404(Poll, pk=poll_id) |
