Skip to content

Instantly share code, notes, and snippets.

@hivre
Last active September 11, 2023 20:20
Show Gist options
  • Save hivre/3cb2213254ecf0dade5e to your computer and use it in GitHub Desktop.
Save hivre/3cb2213254ecf0dade5e to your computer and use it in GitHub Desktop.
WTForms Fieldlist vs FormField iteration
# FieldList
{% for attachment in form.attachment %}
{{ attachment(placeholder='Attachment', class="form-control") }}
{{ form_error(form.errors.other) }}
{% endfor %}
# FormField
{% for member in form.member %}
{{ member.form.name(placeholder='name', class="form-control",required="required") }}
{{ form_error(member.form.errors.name) }}
{{ member.form.hidden_tag() }}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment