url中用法:
urlpatterns = patterns(’’,
url(r’^archive/(\d{4})/$’, archive, name="full-archive"),
url(r’^archive-summary/(\d{4})/$’, archive, {’summary’: True}, name="arch-summary"),
)
函数中用法:
year = 2006
return HttpResponseRedirect(reverse(’full-archive’, args=(year,)))
模板中用法:
{% url ’arch-summary’ 1945 %}
{% url ’full-archive’ 2007 %}
原文地址:http://www.cnblogs.com/tuifeideyouran/p/3858034.html