{% from "components.html" import select_field %} {% macro team_choice(teams, selected, name='owner_team_id', id='owner-team') -%} {%- set options = [] -%} {%- for team in teams %}{% set _ = options.append((team.id, team.name)) %}{% endfor -%} {{ select_field('Owning team', name, id, options, selected=selected, placeholder=('Choose an owning team' if teams|length != 1 else none), required=true, noun='teams') }} {%- endmacro %}