render to string django on text file replace content code example
Example 1: access django object in html
{% for x in data %}
<h3>{{x.name}}</h3>
<h4>{{x.department}}</h4>
{% endfor %}
Example 2: access django object in html
data = model1.objects.all()
return TemplateResponse(request, 'index.html', {'data': data})