r 'str' object is not callable in base.py
|Reported by:||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
Description (last modified by )
Working with SVN revision 7930, following the tutorial, up to the place where the votes view is created.
The line in the vote() method
return HttpResponseRedirect(reverse('mysite.polls.views.results', args=(p.id,)))
fails presenting a debug page that says:
TypeError at /polls/1/results/ 'str' object is not callable Request Method: GET Request URL: http://127.0.0.1:8000/polls/1/results/ Exception Type: TypeError Exception Value: 'str' object is not callable Exception Location: C:\Python25\lib\site-packages\django\core\handlers\base.py in get_response, line 85
I have found some relates issues (like 4700) that point to the INSTALLED_APPS settings and how the django.contrib.auth affects the get_response. I tried eliminating that application and still the error shows.
If using HttpResponseRedirect without the reverse (hardcoding the url) it fails too. If using render_to_response() instead, it works.
Another relate ticket may be 6442, but that one happens when the import error occurs. In this case the imports are ok in views.py, it is the HttpResponseRedirect that may have problems.
Change History (12)
comment:7 Changed 8 years ago by
|Status:||closed → reopened|
|Summary:||HttpResponseRedirect causes a TypeError 'str' object is not callable in base.py → r 'str' object is not callable in base.py|