Given:
urlpatterns = \
patterns('blog.views',
(r'^blog/(?P<year>\d{4})/$', 'year_archive', {'foo': 'bar'}),
)
in a urls.py file. (Should it be 'archive_year' instead of 'year_archive' ? - see below for ref.)
Is it possible to capture information from the URL matching (the value of "year" in this case) for use in the optional dictionary?. E.g.: the value of year instead 'bar'?
Replacing 'bar' with year results in: "NameError ... name 'year' is not defined".
The above is just an example; I know that year is available in the template HTML file for archive_year, but this is not the case for archive_month. And there could be custom information represented in the URL that is needed in a template HTML file.
(The example is from page "URL dispatcher", section "Passing extra options to view functions", http://docs.djangoproject.com/en/dev/topics/http/urls/, in the Django documentation.)