#19110: Tutorial Part 3 suggestion
-------------------------------+--------------------
     Reporter:  pldiver@…      |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Documentation  |    Version:  1.4
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  1              |      UI/UX:  0
-------------------------------+--------------------
 In the Tutorial, part 3 when describing the url patterns and conf stuff,
 for the polls.views.detail ....

 This is worth a review. When somebody requests a page from your Web site
 -- say, "/polls/23/", Django will load this Python module, because it's
 pointed to by the ROOT_URLCONF setting. It finds the variable named
 urlpatterns and traverses the regular expressions in order. When it finds
 a regular expression that matches -- r'^polls/(?P<poll_id>\d+)/$' -- it
 loads the function detail() from polls/views.py. Finally, it calls that
 detail() function like so:

 detail(request=<HttpRequest object>, poll_id=''23')

 The poll_id='23' part comes from (?P<poll_id>\d+). Using parentheses
 around a pattern "captures" the text matched by that pattern and sends it
 as an argument to the view function; the ?P<poll_id> defines the name that
 will be used to identify the matched pattern; and \d+ is a regular
 expression to match a sequence of digits (i.e., a number).

 I suggest you change the poll_id to 1, 2, or 3 as this is what a user has
 setup in the tutorial previously.  poll_id = '23' will bring up the 404
 code.

 Not a big deal, but when just starting out, it is nice to see things work.

 Patrick

-- 
Ticket URL: <https://code.djangoproject.com/ticket/19110>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to