Are there an equal number of hosts and headers? If so, you could use zip(), in your view, to zip them together as follows:
headers_and_hosts = zip(headers, hosts)
Then this would allow you to do something like this in your template:
{% for host, header in headers_and_hosts %}
{% if host.type_of == "Backend" %}
<div class="col-sm-3">{{ host.type_of }}</div>
{{ header }}
{% endif %}
{% endfor %}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…