user126284
user126284

Reputation:

Why doesn't this django code work?

urls.py

url(r'^some/page/$', views.some_page,
    {'template_name': 'some/page.html'},
    name='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.

Upvotes: 0

Views: 459

Answers (1)

David Wolever
David Wolever

Reputation: 154454

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?

Upvotes: 1

Related Questions