{% if data.text %} {% set default_option = data.text %} {% elif 'default' in schema %} {% set default_option = schema.default %} {% else %} {% set default_option = '' %} {% endif %} {% if default_option %} {% set ns = namespace(default_option='') %} {% for option in schema.choices %} {% if option == default_option %} {% set ns.default_option = option %} {% endif %} {% endfor %} {% set default_option = ns.default_option %} {% endif %}