summaryrefslogtreecommitdiff
path: root/docs/intro/tutorial03.txt
diff options
context:
space:
mode:
authorchriscauley <chris@lablackey.com>2014-04-14 14:12:44 -0400
committerTim Graham <timograham@gmail.com>2014-04-16 20:36:29 -0400
commit66ec9ee441618894c1ccebdcdd5eb4d7fbf4a6d3 (patch)
tree956a7d4f6e3b1c348505a3f2d23c7813c6c362b8 /docs/intro/tutorial03.txt
parent030dd4f72ca4d84c0a5e09ee625123d03651fdd1 (diff)
Fixed #22378 -- Updated \d to [0-9]+ in urlpatterns of docs and tests.
Thanks tomwys for the suggestion.
Diffstat (limited to 'docs/intro/tutorial03.txt')
-rw-r--r--docs/intro/tutorial03.txt16
1 files changed, 8 insertions, 8 deletions
diff --git a/docs/intro/tutorial03.txt b/docs/intro/tutorial03.txt
index 3d4f65a720..1d25a58711 100644
--- a/docs/intro/tutorial03.txt
+++ b/docs/intro/tutorial03.txt
@@ -215,11 +215,11 @@ Wire these new views into the ``polls.urls`` module by adding the following
# ex: /polls/
url(r'^$', views.index, name='index'),
# ex: /polls/5/
- url(r'^(?P<question_id>\d+)/$', views.detail, name='detail'),
+ url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
# ex: /polls/5/results/
- url(r'^(?P<question_id>\d+)/results/$', views.results, name='results'),
+ url(r'^(?P<question_id>[0-9]+)/results/$', views.results, name='results'),
# ex: /polls/5/vote/
- url(r'^(?P<question_id>\d+)/vote/$', views.vote, name='vote'),
+ url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),
]
Take a look in your browser, at "/polls/34/". It'll run the ``detail()``
@@ -251,15 +251,15 @@ Here's what happens if a user goes to "/polls/34/" in this system:
* Then, Django will strip off the matching text (``"polls/"``) and send the
remaining text -- ``"34/"`` -- to the 'polls.urls' URLconf for
- further processing which matches ``r'^(?P<question_id>\d+)/$'`` resulting in a
+ further processing which matches ``r'^(?P<question_id>[0-9]+)/$'`` resulting in a
call to the ``detail()`` view like so::
detail(request=<HttpRequest object>, question_id='34')
-The ``question_id='34'`` part comes from ``(?P<question_id>\d+)``. Using parentheses
+The ``question_id='34'`` part comes from ``(?P<question_id>[0-9]+)``. Using parentheses
around a pattern "captures" the text matched by that pattern and sends it as an
argument to the view function; ``?P<question_id>`` defines the name that will
-be used to identify the matched pattern; and ``\d+`` is a regular expression to
+be used to identify the matched pattern; and ``[0-9]+`` is a regular expression to
match a sequence of digits (i.e., a number).
Because the URL patterns are regular expressions, there really is no limit on
@@ -554,7 +554,7 @@ defined below::
...
# the 'name' value as called by the {% url %} template tag
- url(r'^(?P<question_id>\d+)/$', views.detail, name='detail'),
+ url(r'^(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
...
If you want to change the URL of the polls detail view to something else,
@@ -563,7 +563,7 @@ template (or templates) you would change it in ``polls/urls.py``::
...
# added the word 'specifics'
- url(r'^specifics/(?P<question_id>\d+)/$', views.detail, name='detail'),
+ url(r'^specifics/(?P<question_id>[0-9]+)/$', views.detail, name='detail'),
...
Namespacing URL names