De eerste bestuurder weergeven

Dear Olivier,

thank you for your question.

The code may not work properly because the {% for item in period.people %} part goes after {% if forloop.first %}. You need to first determine the collection, i.e. period.people, through which {% if forloop.first %} will be run. Thus, if you swap those two components, please see the code below, then the code should work. Another tip would be to use “person” instead of “item”, as this would help you to follow the code more easily.

In addition, we would kindly ask you to use 3 backticks [```] before and after your code, when you paste part of your code to our Community page. This way, it will be easier to identify and read the code in the whole text. For more information, please follow the link: How to paste your code in a community post

{% for person in period.people %}
  {% if forloop.first %}
    {{ person.custom.last_name }}
    {{ person.custom.first_name }}
  {% endif %}
{% endfor %}

Pleae let us know if you have further questions.

Kind regards,

Irina

1 Like