[Fixed]-Use cycle for value in template

1👍

I think you should assign just one controlling var to the iteration, and then call the fields on it (assuming “value” and “key” are part of the field choices), like this:

{% for vfield in field.field.choices %}
   {% if field.data == value %}
      <option value="{{ vfield.value }}" selected>{{ vfield.key }}</option>
   {% else %}
      <option value="{{ vfield.value }}">{{ vfield.key }}</option>
   {% endif %}
{% endfor %}

Leave a comment