Reputation: 15393
I'm following the steps of the django tutorial (part 4). And I'm here. There is this tag :
{% url 'polls:vote' question.id %}
which triggers the following line in the urls.py file :
url(r'^(?P<question_id>[0-9]+)/vote/$', views.vote, name='vote'),
I want to be sure about these points :
question.id
is the value passed to the template engine to render
the template.
The variable part ((?P<question_id>[0-9]+)
) in the regex will be
replaced by the first argument in the url
tag (question.id
).
The name of the variable part (question_id
) is just the name the view will use to
handle this value (as an argument). So this variable part may have no name (like just
r'^([0-9]+)/vote/$'
).
There could be several variable parts (and then several arguments
passed to {% url %}
tag).
Could anyone confirm this?
Thank you!
Upvotes: 0
Views: 135
Reputation: 1695
A few things:
Upvotes: 1