O'Reilly logo
  • Willoughby Willoughby thinks this is interesting:

{% for currency in currencies %} <option value="{{currency}}" {{'selected="selected"' if currency_from==currency}}>{{currency}}</option> {% endfor %}

From

Cover of Flask: Building Python Web Services

Note

I could not get this to run at all. This appears to work:
<option value="{{currency}}" {% if currency_from==currency %} selected="selected" {% endif %}> {{curren{% for currency in currencies %}