This prints, when the key k
exists in key2
, a empty link, meaning its href is empty. The real value of k
in key2
isn't empty.
# data is a dictionary
{% for k, v in data.key1.items %}
{% if k in data.key2 %}
<h3><a href='{{data.key2.k}}'>{{k}}</a></h3> <!-- this generates <a href>fdsfdsd</a> -->
{% else %}
<h3>{{ k }}</h3>
{% endif %}
{% endfor %}
How do I fix it?