[Answer]-Geting rendered html text in django

0👍

render returns an instance of HttpResponse, you can access the html content via response.content.

response = another_view(request)
rendered_html_text = response.content

Doc of HttpResponse

Updated: It’s better to define your base.html and extend it, put what in common to base.

👤iMom0

1👍

The right way to deal with site-wide content is to write custom templatetags so views don’t have to deal with it. You views should only deal with view-specific stuff.

Leave a comment