Why doesn't this django code work?
urls.py
url(r'^some/page/$', views.some_page,
{'template_name': 'some/page.html'},
name='开发者_C百科some_page'),
views.py
url = request.build_absolute_uri(reverse('some_page')).lower()
response = HttpResponseRedirect(url)
return response
Question: Why doesn't this code work?
url = request.build_absolute_uri(reverse('some_page',
kwargs={"template_name": "another/page.html"})).lower()
I'm using django 1.2 on google appengine. Since I get the same error for any kind of typo/mistake, I didn't think it was useful to paste that error message here.
Thanks.
Because reverse expects the arguments to “fill in” regular expressions in the url. So reverse('some_page')
should work.
What do you expect it to do?
精彩评论