Opened 10 years ago
Closed 10 years ago
#23012 closed Bug (invalid)
Typo in tutorial regex
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.6 |
Severity: | Normal | Keywords: | regex |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
I was following the (excellent) tutorial at https://docs.djangoproject.com/en/1.6/intro/tutorial03/ and noticed what I think is a bug in some of the regexs. For exampe:
# ex: /polls/5/ url(r'^(?P<poll_id>\d+)/$', views.detail, name='detail'),
The regex matches on <domain.name>/poll_id. However, the comment and subsequent documentation say it should match on <domain.name>/polls/poll_id.
I believe the line (and those near it, should be modified as follows:
url(r'^polls/(?P<poll_id>\d+)/$', views.detail, name='detail'),
Note:
See TracTickets
for help on using tickets.
My bad. Bug in user. I incorrectly defined the urlpatterns in my top-level project/urls.py file rather than in the app, as instructed in the tutorial.