urlpatterns = [
- path('polls/', include('polls.urls')),
+ path('polls/', include('polls.urls', namespace="polls")),
path('admin/', admin.site.urls),
]
}}}
Without this change, it gives an NoReverseMatch error, "polls" is not a
registered namespace
Could the tutorial be updated to include this change?
[[https://docs.djangoproject.com/en/2.0/intro/tutorial03/#namespacing-url-
names]]
--
Ticket URL: <https://code.djangoproject.com/ticket/29231>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => invalid
Comment:
This suggestion is incorrect. You may be missing `app_name = 'polls'` in
`polls/urls.py`.
--
Ticket URL: <https://code.djangoproject.com/ticket/29231#comment:1>
* status: closed => new
* resolution: invalid =>
Comment:
Here is my polls/url.py:
{{{
from django.urls import path
from . import views
app_name = 'polls'
urlpatterns = [
# /polls/
path('',views.index, name='index'),
# /polls/5/
path('<int:question_id>/', views.detail, name='detail'),
# /polls/5/results/
path('<int:question_id>/results/', views.results, name='results'),
# /polls/5/vote/
path('<int:question_id>/vote/', views.vote, name='vote'),
]
}}}
And python -m django --version yields 2.0.3
--
Ticket URL: <https://code.djangoproject.com/ticket/29231#comment:2>
Comment (by Paul):
Running in virtualenv, pip list -l:
arrow (0.12.1)
blessed (1.14.2)
Django (2.0.3)
django-picklefield (1.0.0)
django-q (0.9.4)
pip (9.0.1)
python-dateutil (2.7.0)
pytz (2018.3)
setuptools (38.5.2)
six (1.11.0)
uWSGI (2.0.17)
wcwidth (0.1.7)
wheel (0.30.0)
--
Ticket URL: <https://code.djangoproject.com/ticket/29231#comment:3>
Comment (by Paul):
I have created a repo: [[https://github.com/leftcoastbeard/djangotest]]
--
Ticket URL: <https://code.djangoproject.com/ticket/29231#comment:4>
* status: new => closed
* resolution: => fixed
Comment:
Not sure what's going on, but it's working now following the existing
tutorial steps.
--
Ticket URL: <https://code.djangoproject.com/ticket/29231#comment:5>