Thatâs not an accurate statement.
The name parameter (itâs not a function) is a name for a url, thatâs all.
Thatâs not what those docs are saying.
In the tutorial, youâre creating urls for the polls app. These urls are defined in step 3, in the section:
from django.urls import path
from . import views
urlpatterns = [
# ex: /polls/
path("", views.index, name="index"),
# ex: /polls/5/
path("<int:question_id>/", views.detail, name="detail"),
# ex: /polls/5/results/
path("<int:question_id>/results/", views.results, name="results"),
# ex: /polls/5/vote/
path("<int:question_id>/vote/", views.vote, name="vote"),
]
Notice that youâre only specifying the part of the url after polls - because the name polls is defined in your root urls.py file like this:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("polls/", include("polls.urls")),
^^^^^
path("admin/", admin.site.urls),
]
What the docs are saying is that the polls above doesnât need to be polls. You can change that name to anything you want it to be (as long as itâs a valid url), and your application would still work.
In fact, you could have:
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("polls/", include("polls.urls")),
path("my-polls/", include("polls.urls")),
path("admin/", admin.site.urls),
]
and you can then access views.detail for question_id 1 as either /polls/1/ or /my-polls/1/.