{% for item in control_panel.items.all %} {% if item.pk in visible_control_element_list %} {% include "control_element.html" with item=item %} {% endif %} {% endfor %}