{% set groups_dict = {} %} {% for option in request.form_options.users %} {% for group in option.groups %} {% if group not in groups_dict %} {% set _ = groups_dict.update({group: []}) %} {% endif %} {% if option.value not in groups_dict[group] %} {% set _ = groups_dict[group].append(option.value) %} {% endif %} {% endfor %} {% endfor %}

There is no group assigned to any user.