django access model from html 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})