{% with tasks=incident.planned_maintenance_tasks.all %} {% if tasks %} {% endif %} {% endwith %}