Jinja Compat Tests

Enabled engines

selectattr filter

Template

{% for item in items|selectattr('id', 'odd') %}
{{ item.name }}
{% endfor %}

Data

{
  "items": [
    { "id": 1, "name": "alpha" },
    { "id": 2, "name": "bravo" },
    { "id": 3, "name": "delta" }
  ]
}

(error) v1.10.1

'for' statements should use the format 'for x in y': for item in items|selectattr('id', 'odd')

v2.8.0


alpha

delta

v3.0.6


alpha

bravo

delta

v2.5.0


alpha

bravo

delta

(error) v1.4.2

Invalid filter "selectattr".

(error) v1.24.2

Unknown "selectattr" filter.

(error) v0.9.5

Unable to find filter selectattr

Template

{% for item in items|selectattr('is_selected') %}
{{ item.name }}
{% endfor %}

Data

{
  "items": [
    { "name": "alpha", "is_selected": false },
    { "name": "bravo", "is_selected": true },
    { "name": "delta", "is_selected": true }
  ]
}

(error) v1.10.1

Invalid filter: 'selectattr'

v2.8.0


bravo

delta

v3.0.6


alpha

bravo

delta

v2.5.0


bravo

delta

(error) v1.4.2

Invalid filter "selectattr".

(error) v1.24.2

Unknown "selectattr" filter.

(error) v0.9.5

Unable to find filter selectattr