I am looking for a method / method similar to running python. What I would like to do is bind some fields in the table that start with "i -".
My steps:
then linked it to the template:
{% for field in row %} {% if {{ field | startswith }} %} <td><a href="{{ url_for('munin') }}">{{ field | table_field | safe }}</a></td> {% else %} <td>{{ field | table_field | safe}}</td> {% endif %} {% endfor %}
Unfortunately this will not work.
Second step. I did this without a filter, but in a template
{% for field in row %} {% if field[:2] == 'i-' %} <td><a href="{{ url_for('munin') }}">{{ field | table_field | safe }}</a></td> {% else %} <td>{{ field | table_field | safe}}</td> {% endif %} {% endfor %}
This works, but different data is sent to this template, and it works only for this case. I think that [: 2] may be a bit buggy.
So, I'm trying to write a filter, or maybe there is some method that I skip in the documentation.
flask jinja2
Ojmeny
source share