2👍
✅
That’s more or less the point of the new TemplateResponse
class, which is used by TemplateView
– it allows you to modify items after calling render_to_response
and have those modifications show up in the output.
To explicitly disable that, you can just call render()
on the result of the render_to_response
.
response = super(FrontpageView, self).render_to_response(content, **response_kwargs)
reponse.render()
if ...
return response
(Also note, you should use super
rather than specifying the class name directly.)
Source:stackexchange.com