I have the following loop using the Jinja template in a Flask project:
<select style="width: 125px;" id="ddlQuarters" name="ddlQuarters">
{% for e in element_values if e.DataKey == 'Quarter' %}
{% for v in e.DataElementValues | reverse %}
<option value="{{ v.DataElementValueId }}">{{ v.Value }}</option>
{% endfor %}
{% endfor %}
</select>
Is there a way to optimize the jinja for loop so I don't need to do a sub loop to get the data elements that I want? Or, another question, would doing it in a single loop be any different as far as speed goes?