Why does this not work
handler500 = TemplateView.as_view(template_name="500.html")
I get the following exception:
Traceback (most recent call last):
File "/usr/lib/python2.6/wsgiref/handlers.py", line 94, in run
self.finish_response()
File "/usr/lib/python2.6/wsgiref/handlers.py", line 134, in finish_response
for data in self.result:
File "/home/hatem/projects/leadsift_app/.virtualenv/lib/python2.6/site-packages/django/template/response.py", line 117, in __iter__
raise ContentNotRenderedError('The response content must be 'ContentNotRenderedError: The response content must be rendered before it can be iterated over.
I found this set of notes that describe that you are shooting yourself in the foot to use class based views there, why is that?
EDIT: I have ended up using this ... but I am still hoping someone out there would tell me how to get the original oneliner or similar working
class Handler500(TemplateView):
template_name = "500.html"
@classmethod
def as_error_view(cls):
v = cls.as_view()
def view(request):
r = v(request)
r.render()
return r
return view
handler500 = Handler500.as_error_view()