What does this URL pattern mean?
url(r'^(?P<itemnum>\d+)/$', views.confirm, name='confirm-page'),
)
How can I activate it?
What does this URL pattern mean?
url(r'^(?P<itemnum>\d+)/$', views.confirm, name='confirm-page'),
)
How can I activate it?
A request to /75/ or /3/ would call the function views.confirm(itemnum='75') or views.confirm(itemnum='3').
The variable itemnum can hold any number.
You can read more about url dispatcher here.
Let's see:
^ means the beginning of a string(?P<itemnum>\d+) is a named saving group that in your case matches 1 or more digits in a row. The captured part of the url will be passed as a keyword argument to your views.confirm function:
def confirm(request, itemnum=None):
print itemnum
...
$ means the end of a string
Example: 2013 will be captured from http://mydomain.com/2013/.