我有一个名为thetuples的集合,如下所示:
[('mountpoint=X',state='UP'),(mountpoint='Y',state='DOWN'),(mountpoint='Z',state='DOWN'...)]
我将此集合传递给我的一个模板。我想根据状态过滤该集合。尝试以下无济于事
{% for state in states|selectattr('state','down') %}
TemplateRuntimeError: no test named 'down'
{% for state in states|selectattr(state='down') %}
FilterArgumentError: Missing parameter for attribute name
{% for state in states|select(state='down') %}
No error, but doesn't filter at all.