Friday, December 12, 2008

Django tip: AttributeError: 'str' object has no attribute 'has_header'

(permalink)
Here's another quick Django tip that I couldn't find an answer for on google:
AttributeError: 'str' object has no attribute 'has_header'


The error is the result of returning a string in a view instead of using HttpResponseRedirect. For example I accidentally wrote:
return urlresolvers.reverse('crowd-detail')


When what I meant was:
return HttpResponseRedirect(urlresolvers.reverse('crowd-detail'))


Hope that helps someone out there.

Labels:

blog comments powered by Disqus

Links to this post:

Create a Link

<< Home