{% with latest_run=query.runs.first %} {% if just_triggered or latest_run.status == "pending" or latest_run.status == "running" %} {% endif %} {% if just_triggered %} starting… {% elif not latest_run %} no runs yet {% else %} {{ latest_run.get_status_display }} {% if latest_run.status == "success" or latest_run.status == "cancelled" %} ({{ latest_run.new_items_count }} new / {{ latest_run.items_found_count }} found) {% elif latest_run.status == "failed" %} — {{ latest_run.error_message|truncatechars:80 }} {% elif latest_run.status == "running" and latest_run.cancel_requested %} — stopping… {% endif %} {% endif %} {% endwith %}