i don\'t find any solution, how to get the url in template with the following configuration (using Django1.3):
urls.py
urlpatterns = pattern
Yes, you can get your url like this:-
{% url 'bar-url' 1 2 %}
But note that your url configuration should actually be like this:-
urls.py
urlpatterns = patterns('',
url(r'^/foo/(?P\d+)/, include('bar.urls')),
)
bar.urls.py
urlpatterns = patterns('',
(r'^/bar/$, 'bar.views.index'),
url(r'^/bar/(?P\d+)/$, 'bar.views.detail', name='bar-url'),
)
There is no foo-url
unless you specifically map:-
urls.py
urlpatterns = patterns('',
url(r'^/foo/(?P\d+)/$, 'another.views.foo', name='foo'),
url(r'^/foo/(?P\d+)/, include('bar.urls')),
)
Note that $
means the end of the regular expression.