Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.0.X] Fixed #11328 -- Added missing imports in the sample urls.py f…

…rom Tutorial 3. Thanks to marcalj for the report.

Merge of r11021 from trunk.


git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.0.X@11023 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e63e0bb40092f319d11e66e6b2c4936e1ab1f8f8 1 parent c19d10c
Russell Keith-Magee authored June 17, 2009

Showing 1 changed file with 14 additions and 11 deletions. Show diff stats Hide diff stats

  1. 25  docs/intro/tutorial03.txt
25  docs/intro/tutorial03.txt
@@ -16,28 +16,28 @@ a specific function and has a specific template. For example, in a weblog
16 16
 application, you might have the following views:
17 17
 
18 18
     * Blog homepage -- displays the latest few entries.
19  
-    
  19
+
20 20
     * Entry "detail" page -- permalink page for a single entry.
21  
-    
  21
+
22 22
     * Year-based archive page -- displays all months with entries in the
23 23
       given year.
24  
-      
  24
+
25 25
     * Month-based archive page -- displays all days with entries in the
26 26
       given month.
27  
-      
  27
+
28 28
     * Day-based archive page -- displays all entries in the given day.
29  
-    
  29
+
30 30
     * Comment action -- handles posting comments to a given entry.
31 31
 
32 32
 In our poll application, we'll have the following four views:
33 33
 
34 34
     * Poll "archive" page -- displays the latest few polls.
35  
-    
  35
+
36 36
     * Poll "detail" page -- displays a poll question, with no results but
37 37
       with a form to vote.
38  
-    
  38
+
39 39
     * Poll "results" page -- displays results for a particular poll.
40  
-    
  40
+
41 41
     * Vote action -- handles voting for a particular choice in a particular
42 42
       poll.
43 43
 
@@ -82,6 +82,9 @@ Time for an example. Edit ``mysite/urls.py`` so it looks like this::
82 82
 
83 83
     from django.conf.urls.defaults import *
84 84
 
  85
+    from django.contrib import admin
  86
+    admin.autodiscover()
  87
+
85 88
     urlpatterns = patterns('',
86 89
         (r'^polls/$', 'mysite.polls.views.index'),
87 90
         (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
@@ -307,7 +310,7 @@ We'll discuss what you could put in that ``polls/detail.html`` template a bit
307 310
 later, but if you'd like to quickly get the above example working, just::
308 311
 
309 312
     {{ poll }}
310  
-    
  313
+
311 314
 will get you started for now.
312 315
 
313 316
 A shortcut: get_object_or_404()
@@ -371,12 +374,12 @@ Three more things to note about 404 views:
371 374
 
372 375
     * The 404 view is also called if Django doesn't find a match after checking
373 376
       every regular expression in the URLconf.
374  
-      
  377
+
375 378
     * If you don't define your own 404 view -- and simply use the default, which
376 379
       is recommended -- you still have one obligation: To create a ``404.html``
377 380
       template in the root of your template directory. The default 404 view will
378 381
       use that template for all 404 errors.
379  
-      
  382
+
380 383
     * If :setting:`DEBUG` is set to ``False`` (in your settings module) and if
381 384
       you didn't create a ``404.html`` file, an ``Http500`` is raised instead.
382 385
       So remember to create a ``404.html``.

0 notes on commit e63e0bb

Please sign in to comment.
Something went wrong with that request. Please try again.