Django url tag multiple parameters
Posted
by Overdose
on Stack Overflow
See other posts from Stack Overflow
or by Overdose
Published on 2010-04-04T20:11:46Z
Indexed on
2010/04/04
20:23 UTC
Read the original article
Hit count: 235
I have two similar codes. The first one works as expected.
urlpatterns = patterns('',
(r'^(?P<n1>\d)/test/', test),
(r'', test2),
{% url testapp.views.test n1=5 %}
But adding the second parameter makes the result return empty string.
urlpatterns = patterns('',
(r'^(?P<n1>\d)/test(?P<n2>\d)/', test),
(r'', test2),)
{% url testapp.views.test n1=5, n2=2 %}
Views signature:
def test(request, n1, n2=1):
© Stack Overflow or respective owner